ProjectExplorer: Use themed colors in CustomParserConfigDialog

Otherwise the text is unreadable in dark themes.

Change-Id: Ib5db499f51155b17dc0a3b142dbc189c31cf4df2
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Alessandro Portale
2020-01-22 18:20:10 +01:00
parent 164e6f4b9a
commit edd9d620b0

View File

@@ -26,6 +26,8 @@
#include "customparserconfigdialog.h" #include "customparserconfigdialog.h"
#include "ui_customparserconfigdialog.h" #include "ui_customparserconfigdialog.h"
#include <utils/theme/theme.h>
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
#include <QRegularExpression> #include <QRegularExpression>
@@ -270,13 +272,17 @@ bool CustomParserConfigDialog::checkPattern(QLineEdit *pattern, const QString &o
rx.setPattern(pattern->text()); rx.setPattern(pattern->text());
QPalette palette; QPalette palette;
palette.setColor(QPalette::Text, rx.isValid() ? Qt::black : Qt::red); palette.setColor(QPalette::Text,
Utils::creatorTheme()->color(rx.isValid() ? Utils::Theme::TextColorNormal
: Utils::Theme::TextColorError));
pattern->setPalette(palette); pattern->setPalette(palette);
pattern->setToolTip(rx.isValid() ? QString() : rx.errorString()); pattern->setToolTip(rx.isValid() ? QString() : rx.errorString());
*match = rx.match(outputText); *match = rx.match(outputText);
if (rx.pattern().isEmpty() || !rx.isValid() || !match->hasMatch()) { if (rx.pattern().isEmpty() || !rx.isValid() || !match->hasMatch()) {
*errorMessage = QLatin1String("<font color=\"red\">") + tr("Not applicable:") + QLatin1Char(' '); *errorMessage = QString::fromLatin1("<font color=\"%1\">%2 ").arg(
Utils::creatorTheme()->color(Utils::Theme::TextColorError).name(),
tr("Not applicable:"));
if (rx.pattern().isEmpty()) if (rx.pattern().isEmpty())
*errorMessage += tr("Pattern is empty."); *errorMessage += tr("Pattern is empty.");
else if (!rx.isValid()) else if (!rx.isValid())