summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAndreas Hartmetz <andreas.hartmetz@kdab.com>2012-05-12 18:55:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-29 03:25:20 +0200
commit47be29c99be9558284f6d81074b6b0c38213ed71 (patch)
tree53726f1fdb93468e210cde3910372a0a5ba47642 /tools
parent508cbc6704ba9a37bd87bcbb5c0f1459bc41c064 (diff)
downloadqtquick1-47be29c99be9558284f6d81074b6b0c38213ed71.tar.gz
Do not let QML warnings reduce the frame rate in fullscreen mode.
QPlainTextEdit::appendPlainText() can take surprisingly long, even when the widget is hidden. In a demo on embedded hardware we've seen the frame time go up from ~55 milliseconds to ~85 over the first few minutes of the demo running. There was one warning emitted per frame. With this patch there is no significant performance degradation. Change-Id: Ic80409b29a1544f03431e1573811a00925660338 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qml/loggerwidget.cpp8
-rw-r--r--tools/qml/loggerwidget.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp
index 3456d96c..7db3fc83 100644
--- a/tools/qml/loggerwidget.cpp
+++ b/tools/qml/loggerwidget.cpp
@@ -104,6 +104,11 @@ LoggerWidget::LoggerWidget(QWidget *parent) :
void LoggerWidget::append(const QString &msg)
{
+ if (!isVisible()) {
+ // appending the message for real can take a couple of milliseconds, so if we don't have to...
+ m_queuedMessages.append(msg);
+ return;
+ }
m_plainTextEdit->appendPlainText(msg);
if (!isVisible() && (defaultVisibility() == AutoShowWarnings))
@@ -174,6 +179,9 @@ void LoggerWidget::warningsPreferenceChanged(QAction *action)
void LoggerWidget::showEvent(QShowEvent *event)
{
+ foreach (const QString &msg, m_queuedMessages)
+ m_plainTextEdit->appendPlainText(msg);
+ m_queuedMessages.clear();
QWidget::showEvent(event);
emit opened();
}
diff --git a/tools/qml/loggerwidget.h b/tools/qml/loggerwidget.h
index 8ec25f02..bc9991cb 100644
--- a/tools/qml/loggerwidget.h
+++ b/tools/qml/loggerwidget.h
@@ -92,6 +92,7 @@ private:
enum ConfigOrigin { CommandLineOrigin, SettingsOrigin };
ConfigOrigin m_visibilityOrigin;
Visibility m_visibility;
+ QStringList m_queuedMessages;
};
QT_END_NAMESPACE