Qt Quick Designer
We can use QML to easily create a hierarchy of objects. If we need a few input boxes or buttons, we can just add some blocks to the code, just like we added the TextField
and Label
components in the previous example, and our changes will appear in the window. However, when dealing with complex forms, it's sometimes hard to position the objects properly. Instead of trying different anchors
and relaunching the application, you can use the visual form editor to see the changes as you make them.
Time for action – Adding a form to the project
Locate the qml.qrc
file in Qt Creator's project tree and invoke the Add New...
option in its context menu. From Qt
section, select the QtQuick UI File
template. Input Calculator
in the Component name
field. The Component form name
field will be automatically set to CalculatorForm
. Finish the wizard.
Two new files will appear in our project. The CalculatorForm.ui.qml
file is the form file that can be edited in the form editor. The Calculator...