forked from qt-creator/qt-creator
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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user