30 #include <QtCore/QDebug>
50 m_errorTextColor(Qt::red),
56 BaseValidatingLineEdit::BaseValidatingLineEdit(QWidget *parent) :
62 connect(
this, SIGNAL(textChanged(QString)),
this, SLOT(slotChanged(QString)));
65 BaseValidatingLineEdit::~BaseValidatingLineEdit()
70 QString BaseValidatingLineEdit::initialText()
const
75 void BaseValidatingLineEdit::setInitialText(
const QString &
t)
84 QColor BaseValidatingLineEdit::errorColor()
const
89 void BaseValidatingLineEdit::setErrorColor(
const QColor &c)
94 QColor BaseValidatingLineEdit::textColor(
const QWidget *w)
96 return w->palette().color(QPalette::Active, QPalette::Text);
99 void BaseValidatingLineEdit::setTextColor(QWidget *w,
const QColor &c)
101 QPalette palette = w->palette();
102 palette.setColor(QPalette::Active, QPalette::Text, c);
103 w->setPalette(palette);
106 BaseValidatingLineEdit::State BaseValidatingLineEdit::state()
const
111 bool BaseValidatingLineEdit::isValid()
const
116 QString BaseValidatingLineEdit::errorMessage()
const
126 const State newState = isDisplayingInitialText ?
127 DisplayingInitialText :
131 qDebug() << Q_FUNC_INFO << t <<
"State" << m_bd->
m_state <<
"->" << newState << m_bd->
m_errorMessage;
135 const bool validHasChanged = (m_bd->
m_state == Valid) != (newState == Valid);
139 if (validHasChanged) {
152 void BaseValidatingLineEdit::triggerChanged()
virtual bool validate(const QString &value, QString *errorMessage) const =0
virtual void slotReturnPressed()
BaseValidatingLineEditPrivate(const QWidget *w)
virtual void slotChanged(const QString &t)
BaseValidatingLineEdit::State m_state
void validReturnPressed()
const QColor m_okTextColor