diff options
Diffstat (limited to 'src/declarative/graphicsitems/qmlgraphicstextinput.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicstextinput.cpp | 21 |
1 files changed, 21 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 |