diff options
author | Giuseppe D'Angelo <dangelog@gmail.com> | 2012-03-15 09:02:19 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-07 12:04:53 +0100 |
commit | 2d8910cbeda8e88223fa386e4398f13b455fd7ca (patch) | |
tree | ee2c5699d35c50829f078d1556c42d44649809b0 /src/gui/util/qvalidator.h | |
parent | ca2f44680cb97e7a7c46ee0ab26654822fe65e2d (diff) |
Introduce QRegularExpressionValidator
QRegularExpression counterpart for QRegExpValidator.
Change-Id: Ib391e73dd49e32aeb9b48e6f2217b67a17a83a11
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/gui/util/qvalidator.h')
-rw-r--r-- | src/gui/util/qvalidator.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h index e4aa55d578..53acdfb31e 100644 --- a/src/gui/util/qvalidator.h +++ b/src/gui/util/qvalidator.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -45,6 +46,7 @@ #include <QtCore/qobject.h> #include <QtCore/qstring.h> #include <QtCore/qregexp.h> +#include <QtCore/qregularexpression.h> #include <QtCore/qlocale.h> QT_BEGIN_HEADER @@ -195,6 +197,37 @@ private: #endif // QT_NO_REGEXP +#ifndef QT_NO_REGEXP + +class QRegularExpressionValidatorPrivate; + +class Q_GUI_EXPORT QRegularExpressionValidator : public QValidator +{ + Q_OBJECT + Q_PROPERTY(QRegularExpression regularExpression READ regularExpression WRITE setRegularExpression NOTIFY regularExpressionChanged) + +public: + explicit QRegularExpressionValidator(QObject *parent = 0); + explicit QRegularExpressionValidator(const QRegularExpression &re, QObject *parent = 0); + ~QRegularExpressionValidator(); + + virtual QValidator::State validate(QString &input, int &pos) const Q_DECL_OVERRIDE; + + QRegularExpression regularExpression() const; + +public Q_SLOTS: + void setRegularExpression(const QRegularExpression &re); + +Q_SIGNALS: + void regularExpressionChanged(const QRegularExpression &re); + +private: + Q_DISABLE_COPY(QRegularExpressionValidator) + Q_DECLARE_PRIVATE(QRegularExpressionValidator) +}; + +#endif // QT_NO_REGEXP + #endif // QT_NO_VALIDATOR QT_END_NAMESPACE |