From 61bfeff6855a3c023bb6ae400a73ea7ff31244c0 Mon Sep 17 00:00:00 2001 From: Dirk Wilden Date: Tue, 2 Feb 2010 18:00:48 +0000 Subject: [PATCH] speeeeeeed git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8405 383ad7c9-94d9-4d36-a494-682f7c89f535 --- widgets/loggerWidget/loggerWidget.cc | 15 ++++++++++++--- widgets/loggerWidget/loggerWidget.hh | 6 ++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/widgets/loggerWidget/loggerWidget.cc b/widgets/loggerWidget/loggerWidget.cc index 88b10365..45009a4b 100644 --- a/widgets/loggerWidget/loggerWidget.cc +++ b/widgets/loggerWidget/loggerWidget.cc @@ -167,9 +167,11 @@ void LoggerWidget::scrollTo(int _pos){ /// Append a new logmessage to log viewer void LoggerWidget::append(QString _text, Logtype _type){ + QTime time; + time.start(); list_->addItem(_text); - + QListWidgetItem* item = list_->item( list_->count()-1 ); if ( allButton_->isChecked() ) @@ -203,8 +205,10 @@ void LoggerWidget::append(QString _text, Logtype _type){ item->setHidden(false); break; } - - list_->scrollToBottom(); + + if ( !isHidden() ) + list_->scrollToBottom(); + } //------------------------------------------------------------------------------------- @@ -240,6 +244,11 @@ void LoggerWidget::updateList(){ list_->scrollToBottom(); } +//------------------------------------------------------------------------------------- +void LoggerWidget::showEvent ( QShowEvent * event ) { + list_->scrollToBottom(); +} + //------------------------------------------------------------------------------------- /// handle keyPressEvents diff --git a/widgets/loggerWidget/loggerWidget.hh b/widgets/loggerWidget/loggerWidget.hh index 4ed1ad2c..1760f23f 100644 --- a/widgets/loggerWidget/loggerWidget.hh +++ b/widgets/loggerWidget/loggerWidget.hh @@ -81,6 +81,12 @@ class LoggerWidget : public QWidget * This function shows the context menu */ void contextMenuEvent ( QContextMenuEvent * event ); + + /** \brief Called when the widget is shown + * + * Function scrolls to bottom if the object gets visible + */ + void showEvent ( QShowEvent * event ); private: -- GitLab