Skip to content
Permalink
Browse files

[themes] Fix field expression widget not playing nice with themes

  • Loading branch information
nirvn committed May 10, 2019
1 parent 05751a4 commit 28c59c3c0d54e72865cc15bfbae72154b374671a
Showing with 4 additions and 7 deletions.
  1. +4 −6 src/gui/qgsfieldexpressionwidget.cpp
  2. +0 −1 src/gui/qgsfieldexpressionwidget.h
@@ -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 )
@@ -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
{
@@ -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 )
@@ -249,7 +249,6 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
const QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
QString mBackupExpression;
bool mAllowEvalErrors = false;
QPalette mComboPalette;

friend class TestQgsFieldExpressionWidget;
};

0 comments on commit 28c59c3

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