Skip to content
Permalink
Browse files

[theme] fix invisible text in field expression widget in dark themes (#…

…9701)

* [theme] fix invisile text in field expression widget in dark themes

only on MacOS at the moment

* switch back to original palette

* remove useless includes

* don't use pointer
  • Loading branch information
3nids committed Apr 4, 2019
1 parent f1dbcc3 commit 0a10dc504dec344ce15933c6aaaa31128140dccd
@@ -17,6 +17,7 @@
#define QGSATTRIBUTEACTIONPROPERTIESDIALOG_H

#include "ui_qgsattributeactionpropertiesdialogbase.h"
#include "qgsexpressioncontextgenerator.h"

#include "qgsaction.h"
#include "qgshelp.h"
@@ -24,6 +24,7 @@
#include "qgsdockwidget.h"
#include "qgsfeatureiterator.h"
#include "qgstaskmanager.h"
#include "qgsexpressioncontextgenerator.h"

#include "qgis_app.h"

@@ -27,6 +27,7 @@
#include "qgsvectorlayer.h"
#include "qgsproject.h"
#include "qgsexpressioncontextutils.h"
#include "qgsexpressioncontextgenerator.h"

QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent )
: QWidget( parent )
@@ -71,6 +72,8 @@ QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent )
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() );

mCombo->installEventFilter( this );

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

void QgsFieldExpressionWidget::setExpressionDialogTitle( const QString &title )
@@ -337,7 +340,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 );
@@ -362,10 +365,6 @@ void QgsFieldExpressionWidget::updateLineEditStyle( const QString &expression )
{
palette.setColor( QPalette::Text, Qt::red );
}
else
{
palette.setColor( QPalette::Text, Qt::black );
}
}
mCombo->lineEdit()->setPalette( palette );
}
@@ -25,13 +25,13 @@
#include "qgis_gui.h"
#include "qgis_sip.h"
#include "qgsdistancearea.h"
#include "qgsexpressioncontextgenerator.h"
#include "qgsexpressioncontext.h"
#include "qgsfieldproxymodel.h"


class QgsMapLayer;
class QgsVectorLayer;
class QgsExpressionContextGenerator;


/**
@@ -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 0a10dc5

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