[yast-commit] r67385 - in /trunk/qt: VERSION.cmake package/yast2-qt.changes src/YQLogView.cc src/YQLogView.h
Author: tgoettlicher Date: Wed Feb 8 14:54:36 2012 New Revision: 67385 URL: http://svn.opensuse.org/viewcvs/yast?rev=67385&view=rev Log: Fixed bnc#731540: fixed auto-scroll in LogView (2.22.2) Modified: trunk/qt/VERSION.cmake trunk/qt/package/yast2-qt.changes trunk/qt/src/YQLogView.cc trunk/qt/src/YQLogView.h Modified: trunk/qt/VERSION.cmake URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/VERSION.cmake?rev=67385&r1=67384&r2=67385&view=diff ============================================================================== --- trunk/qt/VERSION.cmake (original) +++ trunk/qt/VERSION.cmake Wed Feb 8 14:54:36 2012 @@ -1,3 +1,3 @@ SET(VERSION_MAJOR "2") SET(VERSION_MINOR "22") -SET(VERSION_PATCH "1") +SET(VERSION_PATCH "2") Modified: trunk/qt/package/yast2-qt.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/package/yast2-qt.changes?rev=67385&r1=67384&r2=67385&view=diff ============================================================================== --- trunk/qt/package/yast2-qt.changes (original) +++ trunk/qt/package/yast2-qt.changes Wed Feb 8 14:54:36 2012 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Feb 8 14:54:15 CET 2012 - tgoettlicher@suse.de + +- Fixed bnc#731540: fixed auto-scroll in LogView +- Version: 2.22.2 + +------------------------------------------------------------------- Tue Dec 20 16:30:28 CET 2011 - tgoettlicher@suse.de - Confirmed license Modified: trunk/qt/src/YQLogView.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQLogView.cc?rev=67385&r1=67384&r2=67385&view=diff ============================================================================== --- trunk/qt/src/YQLogView.cc (original) +++ trunk/qt/src/YQLogView.cc Wed Feb 8 14:54:36 2012 @@ -73,7 +73,7 @@ YUI_CHECK_NEW( _caption ); layout->addWidget( _caption ); - _qt_text = new QTextEdit( this ); + _qt_text = new MyTextEdit( this ); YUI_CHECK_NEW( _qt_text ); layout->addWidget( _qt_text ); @@ -82,6 +82,9 @@ _qt_text->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); _caption->setBuddy( _qt_text ); + + connect (_qt_text, SIGNAL(resized()), this, SLOT(slotResize())); + } @@ -119,6 +122,7 @@ { _qt_text->moveCursor( QTextCursor::End ); _qt_text->ensureCursorVisible(); + sb->setValue( sb->maximum() ); } _lastText = newString; @@ -163,6 +167,20 @@ return max( 80, hintHeight ); } +void +YQLogView::slotResize() +{ + QScrollBar *sb = _qt_text->verticalScrollBar(); + + bool atEnd = sb->value() == sb->maximum(); + + if (atEnd) + { + _qt_text->moveCursor( QTextCursor::End ); + _qt_text->ensureCursorVisible(); + sb->setValue( sb->maximum() ); + } +} void YQLogView::setSize( int newWidth, int newHeight ) Modified: trunk/qt/src/YQLogView.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQLogView.h?rev=67385&r1=67384&r2=67385&view=diff ============================================================================== --- trunk/qt/src/YQLogView.h (original) +++ trunk/qt/src/YQLogView.h Wed Feb 8 14:54:36 2012 @@ -49,6 +49,8 @@ #include "YLogView.h" class YQWidgetCaption; +class MyTextEdit; + class YQLogView : public QFrame, public YLogView @@ -127,8 +129,32 @@ protected: YQWidgetCaption * _caption; - QTextEdit * _qt_text; + MyTextEdit * _qt_text; QString _lastText; + +private slots: + void slotResize(); + +}; + + +// We need a resize event in order to set the cursor to the last line +// for the auto-scroll feature +class MyTextEdit : public QTextEdit +{ + Q_OBJECT + public: + MyTextEdit( QWidget* parent ) : QTextEdit (parent) {} + + protected: + void resizeEvent ( QResizeEvent * event ) + { emit resized(); + QTextEdit::resizeEvent(event); + } + + signals: + void resized(); + }; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
tgoettlicher@svn2.opensuse.org