FancyLineEdit: Take validator into account

Take validator into account (if set) when checking validity
of the input.

Change-Id: Ieec7249aff50cf419833693dcf33fb241e4c044a
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Tobias Hunger
2014-09-09 15:23:10 +02:00
parent 990cedeb1b
commit 1eaadfa7d7

View File

@@ -405,8 +405,12 @@ void FancyLineEdit::setTextColor(QWidget *w, const QColor &c)
bool FancyLineEdit::validate(const QString &value, QString *errorMessage) const bool FancyLineEdit::validate(const QString &value, QString *errorMessage) const
{ {
Q_UNUSED(value);
Q_UNUSED(errorMessage); Q_UNUSED(errorMessage);
if (const QValidator *v = validator()) {
QString tmp = value;
int pos = cursorPosition();
return v->validate(tmp, pos) == QValidator::Acceptable;
}
return true; return true;
} }