Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.3
-
None
-
Windows
Description
In QML a RegExpValidator is not applied right after TextInput component is created. As QRegExpValidator will accept anything by default, TextInput.acceptableInput will return true when the component is created. Once TextInput value is modified, the right regexp is applied.
The following code will show the issue. When the application is started the acceptableInput will be true thus the color is set to green.
import QtQuick 1.0 Rectangle { id: root color: input.acceptableInput ? "green" : "red" width: 300; height: 300 Rectangle { anchors.centerIn: parent height: 50 width: 50 color: "white" TextInput { id: input anchors.fill: parent validator: RegExpValidator { regExp: /.{1,4}/ } } } }
Attachments
For Gerrit Dashboard: QTBUG-21103 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
13494,1 | Update TextInput.acceptableInput on component complete. | master | qt/qtdeclarative | Status: MERGED | +2 | 0 |