SVN commit 646640 by raggi: QWidget::show() is not virtual in Qt 4.x :-) M +26 -27 kcompletionbox.cpp M +1 -6 kcompletionbox.h --- trunk/KDE/kdelibs/kdeui/widgets/kcompletionbox.cpp #646639:646640 @@ -317,38 +317,37 @@ } } -void KCompletionBox::show() +void KCompletionBox::setVisible( bool visible ) { - d->upwardBox = false; - if ( d->m_parent ) { - sizeAndPosition(); - qApp->installEventFilter( this ); - } + if (visible) { + d->upwardBox = false; + if ( d->m_parent ) { + sizeAndPosition(); + qApp->installEventFilter( this ); + } - // ### we shouldn't need to call this, but without this, the scrollbars - // are pretty b0rked. - //triggerUpdate( true ); + // ### we shouldn't need to call this, but without this, the scrollbars + // are pretty b0rked. + //triggerUpdate( true ); - // Workaround for I'm not sure whose bug - if this KCompletionBox' parent - // is in a layout, that layout will detect inserting new child (posted - // ChildInserted event), and will trigger relayout (post LayoutHint event). - // QWidget::show() sends also posted ChildInserted events for the parent, - // and later all LayoutHint events, which causes layout updating. - // The problem is, KCompletionBox::eventFilter() detects resizing - // of the parent, and calls hide() - and this hide() happen in the middle - // of show(), causing inconsistent state. I'll try to submit a Qt patch too. - qApp->sendPostedEvents(); - KListWidget::show(); + // Workaround for I'm not sure whose bug - if this KCompletionBox' parent + // is in a layout, that layout will detect inserting new child (posted + // ChildInserted event), and will trigger relayout (post LayoutHint event). + // QWidget::show() sends also posted ChildInserted events for the parent, + // and later all LayoutHint events, which causes layout updating. + // The problem is, KCompletionBox::eventFilter() detects resizing + // of the parent, and calls hide() - and this hide() happen in the middle + // of show(), causing inconsistent state. I'll try to submit a Qt patch too. + qApp->sendPostedEvents(); + } else { + if ( d->m_parent ) + qApp->removeEventFilter( this ); + d->cancelText.clear(); + } + + KListWidget::setVisible(visible); } -void KCompletionBox::hide() -{ - if ( d->m_parent ) - qApp->removeEventFilter( this ); - d->cancelText.clear(); - KListWidget::hide(); -} - QRect KCompletionBox::calculateGeometry() const { int x = 0, y = 0; --- trunk/KDE/kdelibs/kdeui/widgets/kcompletionbox.h #646639:646640 @@ -179,13 +179,8 @@ /** * Re-implemented for internal reasons. API is unaffected. */ - virtual void show(); + virtual void setVisible( bool visible ); - /** - * Re-implemented for internal reasons. API is unaffected. - */ - virtual void hide(); - Q_SIGNALS: /** * Emitted when an item was selected, contains the text of