Skip to content
Permalink
Browse files

[options search] correctly remove event filter

  • Loading branch information
3nids committed Jan 24, 2018
1 parent 0e7cea2 commit 711eddcf8ae0743fa341437877db01d967651fde
Showing with 13 additions and 6 deletions.
  1. +13 −6 src/gui/qgsoptionsdialogbase.cpp
@@ -484,15 +484,22 @@ bool QgsSearchHighlightOptionWidget::eventFilter( QObject *obj, QEvent *event )
{
if ( mInstalledFilter && event->type() == QEvent::Show && obj == mWidget )
{
removeEventFilter( mWidget );
mWidget->removeEventFilter( this );
mInstalledFilter = false;
// instead of catching the event and calling show again
// it might be better to use a timer to change the style
// after the widget is shown
#if 1
mWidget->show();
//QTimer::singleShot( 500, this, [ = ]
//{
mWidget->setStyleSheet( mWidget->styleSheet() + mStyleSheet );
mChangedStyle = true;
//} );
return true;
#else
QTimer::singleShot( 500, this, [ = ]
{
mWidget->setStyleSheet( mWidget->styleSheet() + mStyleSheet );
mChangedStyle = true;
} );
#endif
}
return QObject::eventFilter( obj, event );
}
@@ -510,7 +517,7 @@ void QgsSearchHighlightOptionWidget::reset()
}
else if ( mInstalledFilter )
{
removeEventFilter( mWidget );
mWidget->removeEventFilter( this );
mInstalledFilter = false;
}
}

0 comments on commit 711eddc

Please sign in to comment.
You can’t perform that action at this time.