forked from qt-creator/qt-creator
Utils: Remove "ok" and "error" colors accessors for FancyLineEdit
Change-Id: I4e6706f284182226da8c9815394f36e9764feab2 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -133,19 +133,18 @@ public:
|
|||||||
|
|
||||||
QString m_lastFilterText;
|
QString m_lastFilterText;
|
||||||
|
|
||||||
QColor m_okTextColor;
|
const QColor m_okTextColor;
|
||||||
QColor m_errorTextColor;
|
const QColor m_errorTextColor;
|
||||||
QString m_errorMessage;
|
QString m_errorMessage;
|
||||||
};
|
};
|
||||||
|
|
||||||
FancyLineEditPrivate::FancyLineEditPrivate(FancyLineEdit *parent) :
|
FancyLineEditPrivate::FancyLineEditPrivate(FancyLineEdit *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_lineEdit(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);
|
m_completionShortcut.setContext(Qt::WidgetShortcut);
|
||||||
connect(completionShortcut(), &CompletionShortcut::keyChanged,
|
connect(completionShortcut(), &CompletionShortcut::keyChanged,
|
||||||
&m_completionShortcut, &QShortcut::setKey);
|
&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)
|
void FancyLineEdit::setValidationFunction(const FancyLineEdit::ValidationFunction &fn)
|
||||||
{
|
{
|
||||||
d->m_validationFunction = fn;
|
d->m_validationFunction = fn;
|
||||||
|
|||||||
@@ -73,10 +73,6 @@ class QTCREATOR_UTILS_EXPORT FancyLineEdit : public CompletingLineEdit
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(Side)
|
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:
|
public:
|
||||||
enum Side {Left = 0, Right = 1};
|
enum Side {Left = 0, Right = 1};
|
||||||
|
|
||||||
@@ -131,12 +127,6 @@ public:
|
|||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
QString errorMessage() 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);
|
void setValidationFunction(const ValidationFunction &fn);
|
||||||
static ValidationFunction defaultValidationFunction();
|
static ValidationFunction defaultValidationFunction();
|
||||||
void validate();
|
void validate();
|
||||||
|
|||||||
@@ -347,16 +347,6 @@ void PathChooser::setFileName(const FilePath &fn)
|
|||||||
d->m_lineEdit->setTextKeepingActiveCursor(fn.toUserOutput());
|
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
|
bool PathChooser::isReadOnly() const
|
||||||
{
|
{
|
||||||
return d->m_lineEdit->isReadOnly();
|
return d->m_lineEdit->isReadOnly();
|
||||||
@@ -487,16 +477,6 @@ void PathChooser::setAboutToShowContextMenuHandler(PathChooser::AboutToShowConte
|
|||||||
s_aboutToShowContextMenuHandler = handler;
|
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
|
FancyLineEdit::ValidationFunction PathChooser::defaultValidationFunction() const
|
||||||
{
|
{
|
||||||
return std::bind(&PathChooser::validatePath, this, std::placeholders::_1, std::placeholders::_2);
|
return std::bind(&PathChooser::validatePath, this, std::placeholders::_1, std::placeholders::_2);
|
||||||
|
|||||||
@@ -56,8 +56,6 @@ class QTCREATOR_UTILS_EXPORT PathChooser : public QWidget
|
|||||||
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true)
|
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true)
|
||||||
// Designer does not know this type, so force designable to false:
|
// Designer does not know this type, so force designable to false:
|
||||||
Q_PROPERTY(Utils::FilePath fileName READ fileName WRITE setFileName DESIGNABLE 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:
|
public:
|
||||||
static QString browseButtonLabel();
|
static QString browseButtonLabel();
|
||||||
@@ -147,9 +145,6 @@ public:
|
|||||||
using AboutToShowContextMenuHandler = std::function<void (PathChooser *, QMenu *)>;
|
using AboutToShowContextMenuHandler = std::function<void (PathChooser *, QMenu *)>;
|
||||||
static void setAboutToShowContextMenuHandler(AboutToShowContextMenuHandler handler);
|
static void setAboutToShowContextMenuHandler(AboutToShowContextMenuHandler handler);
|
||||||
|
|
||||||
QColor errorColor() const;
|
|
||||||
QColor okColor() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool validatePath(FancyLineEdit *edit, QString *errorMessage) const;
|
bool validatePath(FancyLineEdit *edit, QString *errorMessage) const;
|
||||||
// Returns overridden title or the one from <title>
|
// Returns overridden title or the one from <title>
|
||||||
@@ -170,9 +165,6 @@ public slots:
|
|||||||
void setPath(const QString &);
|
void setPath(const QString &);
|
||||||
void setFileName(const FilePath &);
|
void setFileName(const FilePath &);
|
||||||
|
|
||||||
void setErrorColor(const QColor &errorColor);
|
|
||||||
void setOkColor(const QColor &okColor);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PathChooserPrivate *d = nullptr;
|
PathChooserPrivate *d = nullptr;
|
||||||
static AboutToShowContextMenuHandler s_aboutToShowContextMenuHandler;
|
static AboutToShowContextMenuHandler s_aboutToShowContextMenuHandler;
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ private:
|
|||||||
void setPalette(const QPalette &p) override
|
void setPalette(const QPalette &p) override
|
||||||
{
|
{
|
||||||
KitAspectWidget::setPalette(p);
|
KitAspectWidget::setPalette(p);
|
||||||
m_chooser->setOkColor(p.color(QPalette::Active, QPalette::Text));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pathWasChanged()
|
void pathWasChanged()
|
||||||
|
|||||||
Reference in New Issue
Block a user