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 2a457f0 commit 89693606bf4ea042791a71da7bde7025af0cb65f
Showing with 4 additions and 7 deletions.
  1. +4 −6 src/gui/qgsfieldexpressionwidget.cpp
  2. +0 −1 src/gui/qgsfieldexpressionwidget.h
@@ -72,8 +72,6 @@ QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent )
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() );

mCombo->installEventFilter( this );

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

void QgsFieldExpressionWidget::setExpressionDialogTitle( const QString &title )
@@ -340,10 +338,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
{
@@ -363,10 +361,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 8969360

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