summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-02-08 15:09:00 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-02-08 15:09:00 (GMT)
commita764c32ee5cab4b40a0ce6807e1e7c3efcc7bdc8 (patch)
treed863b90b7ca56df159593d2a74c35000097491df /src/declarative/graphicsitems
parent3e8e1b369752d8a0b42f088f577f3d33eb29f8a9 (diff)
downloadQt-a764c32ee5cab4b40a0ce6807e1e7c3efcc7bdc8.zip
Qt-a764c32ee5cab4b40a0ce6807e1e7c3efcc7bdc8.tar.gz
Qt-a764c32ee5cab4b40a0ce6807e1e7c3efcc7bdc8.tar.bz2
Support the other validators
Note that a resolution will be required for QTBUG-8025 before the QRegExpValidator is useful. Task-number: QTBUG-7068
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextinput.cpp21
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextinput_p.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp
index 427f9ff..6d79c7a 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp
@@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Qt,4,6,TextInput,QmlGraphicsTextInput);
QML_DEFINE_NOCREATE_TYPE(QValidator);
QML_DEFINE_TYPE(Qt,4,6,QIntValidator,QIntValidator);
+QML_DEFINE_TYPE(Qt,4,6,QDoubleValidator,QDoubleValidator);
+QML_DEFINE_TYPE(Qt,4,6,QRegExpValidator,QRegExpValidator);
/*!
\qmlclass TextInput QmlGraphicsTextInput
@@ -437,6 +439,25 @@ void QmlGraphicsTextInput::setFocusOnPress(bool b)
an acceptable or intermediate state. The accepted signal will only be sent
if the text is in an acceptable state when enter is pressed.
+ Currently supported validators are QIntValidator, QDoubleValidator and
+ QRegExpValidator. For details, refer to their C++ documentation and remember
+ that all Q_PROPERTIES are accessible from Qml. A brief usage guide follows:
+
+ QIntValidator and QDoubleValidator both are controllable through two properties,
+ top and bottom. The difference is that for QIntValidator the top and bottom properties
+ should be integers, and for QDoubleValidator they should be doubles. QRegExpValidator
+ has a single string property, regExp, which should be set to the regular expression to
+ be used for validation. An example of using validators is shown below, which allows
+ input of integers between 11 and 31 into the text input:
+
+ \code
+ import Qt 4.6
+ TextInput{
+ validator: QIntValidator{bottom: 11; top: 31;}
+ focus: true
+ }
+ \endcode
+
\sa acceptableInput, inputMask
*/
QValidator* QmlGraphicsTextInput::validator() const
diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput_p.h b/src/declarative/graphicsitems/qmlgraphicstextinput_p.h
index 56f16a5..68f28f8 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextinput_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicstextinput_p.h
@@ -220,6 +220,8 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QmlGraphicsTextInput)
QML_DECLARE_TYPE(QValidator)
QML_DECLARE_TYPE(QIntValidator)
+QML_DECLARE_TYPE(QDoubleValidator)
+QML_DECLARE_TYPE(QRegExpValidator)
QT_END_HEADER