Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

SpinBox QML Type



  • So in releases prior to 5.13 the spin box control had a "decimal" place property.

    Now it appears to have a place for a Validator property.

    If you use the Designer to make your forms, there doesn't appear a way to create a spinbox with a validator so you can have decimals. You can't add the {} functionality when using the Designer.

    The Help shows 2 SpinBox QML Type definitions on that uses a import QtQuick.Controls 2.5 (validator) and another import QtQuick.Controls 1.4 (decimal)

    The Help show the decimal flavor available since Qt 5.1, yet in the 5.13 install there isn't an option to select the QtQuick.Controls 1.4 on the Designer Import tab.

    I need a control with decimals. What am I missing?


  • Moderators

    @psi_lbc
    hi, i don‘t use the editor for qml, so I can‘t help here, but the docs have an example, how to modify the normal spinbox to work with decimals:

    https://doc.qt.io/qt-5/qml-qtquick-controls2-spinbox.html#custom-values

    hope it helps!



  • @j-hilk

    Thanks. LOL. Yeah, I had that example open. The last app I wrote, I hand did all the QML forms for the UI. That was because the Designer tool was "not quite there" at the time. It seems to work much better now, BUT... There always seems to be the "but". The designer won't allow you to inter-mingle the form design with {} Java-code scripting...which really makes it for design only.

    I guess the frustrating thing I'm running up against is that the Help definitely shows the two SpinBox options QtQuick.Controls 1.4 and 2.5, but with the install I have..a clean install of Qt5.13 I don't even have the QtQuick.Controls 2.5 but rather 2.2. Go figure.

    IDK. Maybe the Designer is just meant to develop a basic UI..then the developer is supposed to add their Java-code features. But once you manually add any Java-code, the Designer won't load the QML form any longer.


Log in to reply