Skip to content

Commit

Permalink
fix invisible text in field expression widget in dark themes (#9709)
Browse files Browse the repository at this point in the history
backport of #9701
  • Loading branch information
3nids committed Apr 6, 2019
1 parent 530b5bf commit 1956cf3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/gui/qgsfieldexpressionwidget.cpp
Expand Up @@ -71,6 +71,8 @@ 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 @@ -337,7 +339,7 @@ void QgsFieldExpressionWidget::currentFieldChanged()

void QgsFieldExpressionWidget::updateLineEditStyle( const QString &expression )
{
QPalette palette = mCombo->lineEdit()->palette();
QPalette palette( mComboPalette );
if ( !isEnabled() )
{
palette.setColor( QPalette::Text, Qt::gray );
Expand All @@ -362,10 +364,6 @@ void QgsFieldExpressionWidget::updateLineEditStyle( const QString &expression )
{
palette.setColor( QPalette::Text, Qt::red );
}
else
{
palette.setColor( QPalette::Text, Qt::black );
}
}
mCombo->lineEdit()->setPalette( palette );
}
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsfieldexpressionwidget.h
Expand Up @@ -249,6 +249,7 @@ 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 1956cf3

Please sign in to comment.