Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release-3_4] [themes] Fix field expression widget not playing nice with themes #9978

Merged
merged 1 commit into from May 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/gui/qgsfieldexpressionwidget.cpp
Expand Up @@ -70,8 +70,6 @@ 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 @@ -338,10 +336,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
{
Expand All @@ -361,10 +359,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 )
Expand Down
1 change: 0 additions & 1 deletion src/gui/qgsfieldexpressionwidget.h
Expand Up @@ -249,7 +249,6 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
const QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
QString mBackupExpression;
bool mAllowEvalErrors = false;
QPalette mComboPalette;

friend class TestQgsFieldExpressionWidget;
};
Expand Down