summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/QmlChanges.txt1
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp17
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/validators.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp1
5 files changed, 16 insertions, 16 deletions
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index 9a55bde..d35a4c2 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -1,6 +1,7 @@
=============================================================================
The changes below are pre Qt 4.7.0 beta
+Removed Q-prefix from validators (IntValidator, DoubleValidator, and RegExpValidator)
PathView: offset property now uses range 0-1.0 rather than 0-100
ListView, GridView::positionViewAtIndex() gained a 'mode' parameter
Removed Qt.playSound (replaced by SoundEffect element)
diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
index 07d7f4d..f422365 100644
--- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
@@ -114,10 +114,10 @@ void QDeclarativeItemModule::defineModule()
qmlRegisterType<QDeclarativePathPercent>("Qt",4,6,"PathPercent");
qmlRegisterType<QDeclarativePathQuad>("Qt",4,6,"PathQuad");
qmlRegisterType<QDeclarativePathView>("Qt",4,6,"PathView");
- qmlRegisterType<QIntValidator>("Qt",4,6,"QIntValidator");
+ qmlRegisterType<QIntValidator>("Qt",4,6,"IntValidator");
#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
- qmlRegisterType<QDoubleValidator>("Qt",4,7,"QDoubleValidator");
- qmlRegisterType<QRegExpValidator>("Qt",4,7,"QRegExpValidator");
+ qmlRegisterType<QDoubleValidator>("Qt",4,7,"DoubleValidator");
+ qmlRegisterType<QRegExpValidator>("Qt",4,7,"RegExpValidator");
#endif
qmlRegisterType<QDeclarativeRectangle>("Qt",4,6,"Rectangle");
qmlRegisterType<QDeclarativeRepeater>("Qt",4,6,"Repeater");
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index b049728..f57ffc1 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -428,20 +428,21 @@ void QDeclarativeTextInput::setFocusOnPress(bool b)
}
/*!
- \qmlproperty QValidator* TextInput::validator
+ \qmlproperty Validator TextInput::validator
- Allows you to set a QValidator on the TextInput. When a validator is set
+ Allows you to set a validator on the TextInput. When a validator is set
the TextInput will only accept input which leaves the text property in
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
+ Currently supported validators are IntValidator, DoubleValidator and
+ RegExpValidator. For details, refer to their C++ documentation (QIntValidator,
+ QDoubleValidator, and QRegExpValidator) 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
+ IntValidator and DoubleValidator both are controllable through two properties,
+ top and bottom. The difference is that for IntValidator the top and bottom properties
+ should be integers, and for DoubleValidator they should be doubles. RegExpValidator
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:
@@ -449,7 +450,7 @@ void QDeclarativeTextInput::setFocusOnPress(bool b)
\code
import Qt 4.6
TextInput{
- validator: QIntValidator{bottom: 11; top: 31;}
+ validator: IntValidator{bottom: 11; top: 31;}
focus: true
}
\endcode
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml
index 0c81548..efe7570 100644
--- a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml
+++ b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml
@@ -9,14 +9,13 @@ Item {
Column{
TextInput { id: intInput;
- validator: QIntValidator{top: 11; bottom: 2}
+ validator: IntValidator{top: 11; bottom: 2}
}
TextInput { id: dblInput;
- validator: QDoubleValidator{top: 12.12; bottom: 2.93; decimals: 2; notation: QDoubleValidator.StandardNotation}
+ validator: DoubleValidator{top: 12.12; bottom: 2.93; decimals: 2; notation: DoubleValidator.StandardNotation}
}
TextInput { id: strInput;
- //Requires QTBUG-8025 to be implemented first
- //validator: QRegExpValidator { regExp: /[a-zA-z]{2,4}/;}
+ validator: RegExpValidator { regExp: RegExp(/[a-zA-z]{2,4}/) }
}
}
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index febcec3..84e7182 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -463,7 +463,6 @@ void tst_qdeclarativetextinput::validators()
QVERIFY(strInput->hasFocus() == true);
QTest::keyPress(canvas, Qt::Key_1);
QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10);
- QEXPECT_FAIL("","Will not work until QTBUG-8025 is resolved", Abort);
QCOMPARE(strInput->text(), QLatin1String(""));
QCOMPARE(strInput->hasAcceptableInput(), false);
QTest::keyPress(canvas, Qt::Key_A);