Skip to content

Commit

Permalink
[options search] correctly remove event filter
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jan 24, 2018
1 parent 0e7cea2 commit 711eddc
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/gui/qgsoptionsdialogbase.cpp
Expand Up @@ -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 );
}
Expand All @@ -510,7 +517,7 @@ void QgsSearchHighlightOptionWidget::reset()
}
else if ( mInstalledFilter )
{
removeEventFilter( mWidget );
mWidget->removeEventFilter( this );
mInstalledFilter = false;
}
}
Expand Down

0 comments on commit 711eddc

Please sign in to comment.