Navigation Menu

Skip to content

Commit

Permalink
[themes] Fix field expression widget not playing nice with themes
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed May 10, 2019
1 parent 05751a4 commit 28c59c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/gui/qgsfieldexpressionwidget.cpp
Expand Up @@ -71,8 +71,6 @@ QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent )
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() );

mCombo->installEventFilter( this );

mComboPalette = mCombo->lineEdit()->palette();
}

void QgsFieldExpressionWidget::setExpressionDialogTitle( const QString &title )
Expand Down Expand Up @@ -339,10 +337,10 @@ void QgsFieldExpressionWidget::currentFieldChanged()

void QgsFieldExpressionWidget::updateLineEditStyle( const QString &expression )
{
QPalette palette( mComboPalette );
QString stylesheet;
if ( !isEnabled() )
{
palette.setColor( QPalette::Text, Qt::gray );
stylesheet = QStringLiteral( "QLineEdit { color: %1; } Qt::gray );" ).arg( QColor( Qt::gray ).name() );
}
else
{
Expand All @@ -362,10 +360,10 @@ void QgsFieldExpressionWidget::updateLineEditStyle( const QString &expression )

if ( isExpression && !isValid )
{
palette.setColor( QPalette::Text, Qt::red );
stylesheet = QStringLiteral( "QLineEdit { color: %1; } Qt::gray );" ).arg( QColor( Qt::red ).name() );
}
}
mCombo->lineEdit()->setPalette( palette );
mCombo->lineEdit()->setStyleSheet( stylesheet );
}

bool QgsFieldExpressionWidget::isExpressionValid( const QString &expressionStr )
Expand Down
1 change: 0 additions & 1 deletion src/gui/qgsfieldexpressionwidget.h
Expand Up @@ -249,7 +249,6 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
const QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
QString mBackupExpression;
bool mAllowEvalErrors = false;
QPalette mComboPalette;

friend class TestQgsFieldExpressionWidget;
};
Expand Down

0 comments on commit 28c59c3

Please sign in to comment.