qml spinbox editable and validation
-
HI all,
I faced a stupid issue and don't find how to solve it.
I have created a simple qml spinbox editable.import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 import QtQuick.Dialogs 1.3 Item { property bool isEnableWithoutConnect: true property bool disableConnectWidgets: true ColumnLayout { SpinBox { id: spinboxInt from : -100 to : 100 editable: true } } }
When I change the value out of the limit (for example 150) and press enter, the spinbox text is correctly limited to the from property value (the spinbox display 100 and dimmed the + button which is ok). But if I edit the value again to an out of range value (130 for example) and press enter, the text is no more updated to the upper limit. (the spinbox display 130)
This seems to me not normal. Is it?
How can I handle this?Thanks
-
HI all,
I faced a stupid issue and don't find how to solve it.
I have created a simple qml spinbox editable.import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 import QtQuick.Dialogs 1.3 Item { property bool isEnableWithoutConnect: true property bool disableConnectWidgets: true ColumnLayout { SpinBox { id: spinboxInt from : -100 to : 100 editable: true } } }
When I change the value out of the limit (for example 150) and press enter, the spinbox text is correctly limited to the from property value (the spinbox display 100 and dimmed the + button which is ok). But if I edit the value again to an out of range value (130 for example) and press enter, the text is no more updated to the upper limit. (the spinbox display 130)
This seems to me not normal. Is it?
How can I handle this?Thanks
@lorenwell your qt version may be too low. I just tested your code with Qt 5.15.2 on Ubuntu and it works just fine with qmlscene
import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import QtQuick.Dialogs 1.3 Item { property bool isEnableWithoutConnect: true property bool disableConnectWidgets: true ColumnLayout { SpinBox { id: spinboxInt from : -100 to : 100 editable: true } } }
-
@lorenwell your qt version may be too low. I just tested your code with Qt 5.15.2 on Ubuntu and it works just fine with qmlscene
import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import QtQuick.Dialogs 1.3 Item { property bool isEnableWithoutConnect: true property bool disableConnectWidgets: true ColumnLayout { SpinBox { id: spinboxInt from : -100 to : 100 editable: true } } }
@JoeCFD Yes you are right. I was stay on version 5.12.12.
I have just try with version 6.6.1 and the control works has expected.
Very surprise this kind of "bug"/"strange behavior" has stay on version 5.12 which was an LTS.Anyway thanks a lot for your answer
-