summaryrefslogtreecommitdiffstats
path: root/installerbuilder/libinstaller/lazyplaintextedit.cpp
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@nokia.com>2011-08-25 17:51:50 +0200
committerTim Jenssen <tim.jenssen@nokia.com>2011-08-29 12:25:57 +0200
commita57d2a0698e4b9587f9aad025e7e7b108b945fab (patch)
treeb1795e67cc7fd3351fe634b18ef829f922657961 /installerbuilder/libinstaller/lazyplaintextedit.cpp
parent90824a03f29af2e56f2058e4f08293e9bad825e6 (diff)
Do not append the output if it is empty.
For some unknown reason it will then append a new line. Use a more appropriate wording for the timer interval. Change-Id: Iddfe5a2a3103f31285dba14a251b5c87ab51c3bf Reviewed-on: http://codereview.qt.nokia.com/3647 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Niels Weber <niels.2.weber@nokia.com> Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder/libinstaller/lazyplaintextedit.cpp')
-rw-r--r--installerbuilder/libinstaller/lazyplaintextedit.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/installerbuilder/libinstaller/lazyplaintextedit.cpp b/installerbuilder/libinstaller/lazyplaintextedit.cpp
index 40b8dcdf5..51ed080a0 100644
--- a/installerbuilder/libinstaller/lazyplaintextedit.cpp
+++ b/installerbuilder/libinstaller/lazyplaintextedit.cpp
@@ -34,7 +34,7 @@
#include <QScrollBar>
-#define TIMER_TIME 20
+#define INTERVAL 20
LazyPlainTextEdit::LazyPlainTextEdit(QWidget *parent) :
QPlainTextEdit(parent), m_timerId(0)
@@ -47,7 +47,8 @@ void LazyPlainTextEdit::timerEvent(QTimerEvent *event)
killTimer(m_timerId);
m_timerId = 0;
m_chachedOutput.chop(1); //removes the last \n
- appendPlainText(m_chachedOutput);
+ if (!m_chachedOutput.isEmpty())
+ appendPlainText(m_chachedOutput);
horizontalScrollBar()->setValue( 0 );
m_chachedOutput.clear();
}
@@ -61,7 +62,7 @@ void LazyPlainTextEdit::append(const QString &text)
//}
m_chachedOutput.append(text + QLatin1String("\n"));
if (isVisible() && m_timerId == 0) {
- m_timerId = startTimer(TIMER_TIME);
+ m_timerId = startTimer(INTERVAL);
}
}
@@ -83,7 +84,7 @@ void LazyPlainTextEdit::setVisible ( bool visible )
m_timerId = 0;
}
if (visible) {
- m_timerId = startTimer(TIMER_TIME);
+ m_timerId = startTimer(INTERVAL);
}
QPlainTextEdit::setVisible(visible);
}