Skip to content
Permalink
Browse files

fix invisible text in field expression widget in dark themes (#9733)

backport of #9701
  • Loading branch information
backporting authored and 3nids committed Apr 6, 2019
1 parent ec8bfa8 commit 6a43d694afa371d1ab5337f505218de11275b9a0
Showing with 4 additions and 5 deletions.
  1. +3 −5 src/gui/qgsfieldexpressionwidget.cpp
  2. +1 −0 src/gui/qgsfieldexpressionwidget.h
@@ -70,6 +70,8 @@ QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent )
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() );

mCombo->installEventFilter( this );

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

void QgsFieldExpressionWidget::setExpressionDialogTitle( const QString &title )
@@ -336,7 +338,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 );
@@ -361,10 +363,6 @@ void QgsFieldExpressionWidget::updateLineEditStyle( const QString &expression )
{
palette.setColor( QPalette::Text, Qt::red );
}
else
{
palette.setColor( QPalette::Text, Qt::black );
}
}
mCombo->lineEdit()->setPalette( palette );
}
@@ -249,6 +249,7 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
const QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
QString mBackupExpression;
bool mAllowEvalErrors = false;
QPalette mComboPalette;

friend class TestQgsFieldExpressionWidget;
};

0 comments on commit 6a43d69

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