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

Change-Id: I4fcd72e8b9281d1cdb404ccc268c453417ec35db
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-10-13 15:16:08 +02:00
parent 2e8332088b
commit 981f7411d3
2 changed files with 28 additions and 0 deletions

View File

@@ -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)
public:
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;
private:
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);
private:
PathChooserPrivate *d;
static AboutToShowContextMenuHandler s_aboutToShowContextMenuHandler;