From 1519dbf0c7b0a84cc5991ce8c9914a24129a40d9 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 19 Dec 2019 12:25:05 +0100 Subject: [PATCH] Utils: Remove "ok" and "error" colors accessors for FancyLineEdit Change-Id: I4e6706f284182226da8c9815394f36e9764feab2 Reviewed-by: Eike Ziller --- src/libs/utils/fancylineedit.cpp | 33 +++---------------- src/libs/utils/fancylineedit.h | 10 ------ src/libs/utils/pathchooser.cpp | 20 ----------- src/libs/utils/pathchooser.h | 8 ----- .../projectexplorer/kitinformation.cpp | 1 - 5 files changed, 5 insertions(+), 67 deletions(-) diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp index e1460d18971..c0d2852db66 100644 --- a/src/libs/utils/fancylineedit.cpp +++ b/src/libs/utils/fancylineedit.cpp @@ -133,19 +133,18 @@ public: QString m_lastFilterText; - QColor m_okTextColor; - QColor m_errorTextColor; + const QColor m_okTextColor; + const QColor m_errorTextColor; QString m_errorMessage; }; FancyLineEditPrivate::FancyLineEditPrivate(FancyLineEdit *parent) : QObject(parent), m_lineEdit(parent), - m_completionShortcut(completionShortcut()->key(), parent) + m_completionShortcut(completionShortcut()->key(), parent), + m_okTextColor(creatorTheme()->color(Theme::TextColorNormal)), + m_errorTextColor(creatorTheme()->color(Theme::TextColorError)) { - m_okTextColor = creatorTheme()->color(Theme::TextColorNormal); - m_errorTextColor = creatorTheme()->color(Theme::TextColorError); - m_completionShortcut.setContext(Qt::WidgetShortcut); connect(completionShortcut(), &CompletionShortcut::keyChanged, &m_completionShortcut, &QShortcut::setKey); @@ -451,28 +450,6 @@ void FancyLineEdit::setFiltering(bool on) } } -QColor FancyLineEdit::errorColor() const -{ - return d->m_errorTextColor; -} - -void FancyLineEdit::setErrorColor(const QColor &c) -{ - d->m_errorTextColor = c; - validate(); -} - -QColor FancyLineEdit::okColor() const -{ - return d->m_okTextColor; -} - -void FancyLineEdit::setOkColor(const QColor &c) -{ - d->m_okTextColor = c; - validate(); -} - void FancyLineEdit::setValidationFunction(const FancyLineEdit::ValidationFunction &fn) { d->m_validationFunction = fn; diff --git a/src/libs/utils/fancylineedit.h b/src/libs/utils/fancylineedit.h index 9f738fb6186..f8f626af60a 100644 --- a/src/libs/utils/fancylineedit.h +++ b/src/libs/utils/fancylineedit.h @@ -73,10 +73,6 @@ class QTCREATOR_UTILS_EXPORT FancyLineEdit : public CompletingLineEdit Q_OBJECT Q_ENUMS(Side) - // Validation. - Q_PROPERTY(QColor errorColor READ errorColor WRITE setErrorColor DESIGNABLE true) - Q_PROPERTY(QColor okColor READ okColor WRITE setOkColor DESIGNABLE true) - public: enum Side {Left = 0, Right = 1}; @@ -131,12 +127,6 @@ public: bool isValid() const; QString errorMessage() const; - QColor errorColor() const; - void setErrorColor(const QColor &c); - - QColor okColor() const; - void setOkColor(const QColor &c); - void setValidationFunction(const ValidationFunction &fn); static ValidationFunction defaultValidationFunction(); void validate(); diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 40a14240429..bc874241a3f 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -347,16 +347,6 @@ void PathChooser::setFileName(const FilePath &fn) d->m_lineEdit->setTextKeepingActiveCursor(fn.toUserOutput()); } -void PathChooser::setErrorColor(const QColor &errorColor) -{ - d->m_lineEdit->setErrorColor(errorColor); -} - -void PathChooser::setOkColor(const QColor &okColor) -{ - d->m_lineEdit->setOkColor(okColor); -} - bool PathChooser::isReadOnly() const { return d->m_lineEdit->isReadOnly(); @@ -487,16 +477,6 @@ void PathChooser::setAboutToShowContextMenuHandler(PathChooser::AboutToShowConte s_aboutToShowContextMenuHandler = handler; } -QColor PathChooser::errorColor() const -{ - return d->m_lineEdit->errorColor(); -} - -QColor PathChooser::okColor() const -{ - return d->m_lineEdit->okColor(); -} - FancyLineEdit::ValidationFunction PathChooser::defaultValidationFunction() const { return std::bind(&PathChooser::validatePath, this, std::placeholders::_1, std::placeholders::_2); diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h index 36776804875..016f088f2d1 100644 --- a/src/libs/utils/pathchooser.h +++ b/src/libs/utils/pathchooser.h @@ -56,8 +56,6 @@ class QTCREATOR_UTILS_EXPORT PathChooser : public QWidget Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true) // Designer does not know this type, so force designable to false: Q_PROPERTY(Utils::FilePath fileName READ fileName WRITE setFileName DESIGNABLE false) - Q_PROPERTY(QColor errorColor READ errorColor WRITE setErrorColor DESIGNABLE true) - Q_PROPERTY(QColor okColor READ okColor WRITE setOkColor DESIGNABLE true) public: static QString browseButtonLabel(); @@ -147,9 +145,6 @@ public: using AboutToShowContextMenuHandler = std::function; static void setAboutToShowContextMenuHandler(AboutToShowContextMenuHandler handler); - QColor errorColor() const; - QColor okColor() const; - private: bool validatePath(FancyLineEdit *edit, QString *errorMessage) const; // Returns overridden title or the one from @@ -170,9 +165,6 @@ public slots: void setPath(const QString &); void setFileName(const FilePath &); - void setErrorColor(const QColor &errorColor); - void setOkColor(const QColor &okColor); - private: PathChooserPrivate *d = nullptr; static AboutToShowContextMenuHandler s_aboutToShowContextMenuHandler; diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp index 500dd7d7053..8d06419100e 100644 --- a/src/plugins/projectexplorer/kitinformation.cpp +++ b/src/plugins/projectexplorer/kitinformation.cpp @@ -98,7 +98,6 @@ private: void setPalette(const QPalette &p) override { KitAspectWidget::setPalette(p); - m_chooser->setOkColor(p.color(QPalette::Active, QPalette::Text)); } void pathWasChanged()