Skip to content

Commit 1956cf3

Browse files
authored
fix invisible text in field expression widget in dark themes (#9709)
backport of #9701
1 parent 530b5bf commit 1956cf3

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/gui/qgsfieldexpressionwidget.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent )
7171
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() );
7272

7373
mCombo->installEventFilter( this );
74+
75+
mComboPalette = mCombo->lineEdit()->palette();
7476
}
7577

7678
void QgsFieldExpressionWidget::setExpressionDialogTitle( const QString &title )
@@ -337,7 +339,7 @@ void QgsFieldExpressionWidget::currentFieldChanged()
337339

338340
void QgsFieldExpressionWidget::updateLineEditStyle( const QString &expression )
339341
{
340-
QPalette palette = mCombo->lineEdit()->palette();
342+
QPalette palette( mComboPalette );
341343
if ( !isEnabled() )
342344
{
343345
palette.setColor( QPalette::Text, Qt::gray );
@@ -362,10 +364,6 @@ void QgsFieldExpressionWidget::updateLineEditStyle( const QString &expression )
362364
{
363365
palette.setColor( QPalette::Text, Qt::red );
364366
}
365-
else
366-
{
367-
palette.setColor( QPalette::Text, Qt::black );
368-
}
369367
}
370368
mCombo->lineEdit()->setPalette( palette );
371369
}

src/gui/qgsfieldexpressionwidget.h

+1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
249249
const QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
250250
QString mBackupExpression;
251251
bool mAllowEvalErrors = false;
252+
QPalette mComboPalette;
252253

253254
friend class TestQgsFieldExpressionWidget;
254255
};

0 commit comments

Comments
 (0)