Navigation Menu

Skip to content

Commit

Permalink
[options search] move Message bar items check to QgsSearchHighlightOp…
Browse files Browse the repository at this point in the history
…tionWidget constructor
  • Loading branch information
3nids committed Jan 25, 2018
1 parent 3b14380 commit 6424ceb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/gui/qgsoptionsdialogbase.cpp
Expand Up @@ -265,10 +265,6 @@ void QgsOptionsDialogBase::registerTextSearchWidgets()
{
Q_FOREACH ( QWidget *w, mOptStackedWidget->widget( i )->findChildren<QWidget *>() )
{
// do not register message bar content, items disappear and causes QGIS to crash
if ( qobject_cast< QgsMessageBarItem * >( w ) || qobject_cast< QgsMessageBarItem * >( w->parentWidget() ) )
continue;

QgsSearchHighlightOptionWidget *shw = new QgsSearchHighlightOptionWidget( w );
if ( shw->isValid() )
{
Expand Down Expand Up @@ -399,6 +395,17 @@ QgsSearchHighlightOptionWidget::QgsSearchHighlightOptionWidget( QWidget *widget
: QObject( widget )
, mWidget( widget )
{
QWidget *parent = widget;
while ( ( parent = parent->parentWidget() ) )
{
// do not register message bar content, items disappear and causes QGIS to crash
if ( qobject_cast< QgsMessageBarItem * >( parent ) )
{
mValid = false;
return;
}
}

if ( qobject_cast<QLabel *>( widget ) )
{
mStyleSheet = QStringLiteral( "QLabel { background-color: yellow; color: blue;}" );
Expand Down

0 comments on commit 6424ceb

Please sign in to comment.