diff options
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 |