forked from qt-creator/qt-creator
FancyLineEdit: Allow to set the ok color
... and not just the error color. Change-Id: I7fabd85404193ca3ee54d27025ca952995a0840f Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -105,7 +105,7 @@ public:
|
||||
|
||||
QString m_lastFilterText;
|
||||
|
||||
const QColor m_okTextColor;
|
||||
QColor m_okTextColor;
|
||||
QColor m_errorTextColor = Qt::red;
|
||||
QString m_errorMessage;
|
||||
QString m_initialText;
|
||||
@@ -113,9 +113,10 @@ public:
|
||||
|
||||
FancyLineEditPrivate::FancyLineEditPrivate(FancyLineEdit *parent) :
|
||||
QObject(parent),
|
||||
m_lineEdit(parent),
|
||||
m_okTextColor(FancyLineEdit::textColor(parent))
|
||||
m_lineEdit(parent)
|
||||
{
|
||||
m_okTextColor = parent->palette().color(QPalette::Active, QPalette::Text);
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
m_iconbutton[i] = new IconButton(parent);
|
||||
m_iconbutton[i]->installEventFilter(this);
|
||||
@@ -396,11 +397,18 @@ QColor FancyLineEdit::errorColor() const
|
||||
void FancyLineEdit::setErrorColor(const QColor &c)
|
||||
{
|
||||
d->m_errorTextColor = c;
|
||||
validate();
|
||||
}
|
||||
|
||||
QColor FancyLineEdit::textColor(const QWidget *w)
|
||||
QColor FancyLineEdit::okColor() const
|
||||
{
|
||||
return w->palette().color(QPalette::Active, QPalette::Text);
|
||||
return d->m_okTextColor;
|
||||
}
|
||||
|
||||
void FancyLineEdit::setOkColor(const QColor &c)
|
||||
{
|
||||
d->m_okTextColor = c;
|
||||
validate();
|
||||
}
|
||||
|
||||
void FancyLineEdit::setTextColor(QWidget *w, const QColor &c)
|
||||
|
@@ -84,6 +84,7 @@ class QTCREATOR_UTILS_EXPORT FancyLineEdit : public CompletingLineEdit
|
||||
// Validation.
|
||||
Q_PROPERTY(QString initialText READ initialText WRITE setInitialText DESIGNABLE true)
|
||||
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};
|
||||
@@ -141,9 +142,11 @@ public:
|
||||
void setInitialText(const QString &);
|
||||
|
||||
QColor errorColor() const;
|
||||
void setErrorColor(const QColor &);
|
||||
void setErrorColor(const QColor &c);
|
||||
|
||||
QColor okColor() const;
|
||||
void setOkColor(const QColor &c);
|
||||
|
||||
static QColor textColor(const QWidget *w);
|
||||
static void setTextColor(QWidget *w, const QColor &c);
|
||||
|
||||
void setValidationFunction(const ValidationFunction &fn);
|
||||
|
Reference in New Issue
Block a user