Commit 981f7411 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

PathChooser: Add interface to set ok/error color for lineedit

Change-Id: I4fcd72e8b9281d1cdb404ccc268c453417ec35db
Reviewed-by: default avatarEike Ziller <>
parent 2e833208
......@@ -336,6 +336,16 @@ void PathChooser::setFileName(const FileName &fn)
void PathChooser::setErrorColor(const QColor &errorColor)
void PathChooser::setOkColor(const QColor &okColor)
bool PathChooser::isReadOnly() const
return d->m_lineEdit->isReadOnly();
......@@ -461,6 +471,16 @@ 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);
......@@ -62,6 +62,8 @@ class QTCREATOR_UTILS_EXPORT PathChooser : public QWidget
// Designer does not know this type, so force designable to false:
Q_PROPERTY(Utils::FileName fileName READ fileName WRITE setFileName DESIGNABLE false)
Q_PROPERTY(Utils::FileName baseFileName READ baseFileName WRITE setBaseFileName DESIGNABLE false)
Q_PROPERTY(QColor errorColor READ errorColor WRITE setErrorColor DESIGNABLE true)
Q_PROPERTY(QColor okColor READ okColor WRITE setOkColor DESIGNABLE true)
static QString browseButtonLabel();
......@@ -145,6 +147,9 @@ public:
using AboutToShowContextMenuHandler = std::function<void (Utils::PathChooser *, QMenu *)>;
static void setAboutToShowContextMenuHandler(AboutToShowContextMenuHandler handler);
QColor errorColor() const;
QColor okColor() const;
bool validatePath(FancyLineEdit *edit, QString *errorMessage) const;
// Returns overridden title or the one from <title>
......@@ -165,6 +170,9 @@ public slots:
void setPath(const QString &);
void setFileName(const Utils::FileName &);
void setErrorColor(const QColor &errorColor);
void setOkColor(const QColor &okColor);
PathChooserPrivate *d;
static AboutToShowContextMenuHandler s_aboutToShowContextMenuHandler;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment