Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.7, 5.15.1
-
None
Description
In the following example, I have a TextInput where the font color should become green whenever a valid IP address is entered. This works fine on Linux and on some Android phones. However, it fails on eg a Mi Mix 3 and Google Pixel 3
When adding logging, it seems that `txtInput.text` becomes empty right after entering the digit that makes the entry valid (txtInput.displayText remains correct).
Using `rect.ipRegex.test(displayText)` instead of `acceptableInput` works just fine hence it has a low priority.
Not sure whether other validators will show the same erroneous behavior.
import QtQuick 2.12 import QtQuick.Window 2.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Rectangle { id: rect width: 100 height: 40 color: "grey" property var ipRegex: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/ TextInput { id: txtInput anchors.fill: parent text: "" color: acceptableInput? "green" : "red" inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase validator: RegExpValidator { id: validatorId regExp: rect.ipRegex } } } }