Qt World Summit: Register Today!

How can I create simple container directly usable in QML designer.

  • Hello.

    Let say I want to create simple control that would have a expand/collapse button, with some label, plus some place for user defined context, that would be shown or hidden depending on control state.

    While the above is simple to achieve in QML, I can't find any materials on how to write it so that I could use it in QML designer like standard controls (so drag it onto my form, and using the designer "inject" it with some context - be it, other control, text, image etc.).

    How can I achieve this?

    Thanks in advance.

    Best regards.

  • Here you can find a small example how to integrate a custom qml plugin into the designer: https://qt.gitorious.org/qt-creator/qt-creator/source/394c9dd5507df610f7d60a56b7bf7e707a59142f:tests/manual/qml/testprojects/plugins

    This is a manual test case, that we use to test the integration of custom QML items. If you put the QML file next to the file you edit (no import needed) nothing is required to get a basic integration.

    To get something like a collapsable GroupBox working I would suggest to overload the default property using an lias property, like the GroupBox of the Qt Quick Controls does it. The state of of the GroupBox should be exposed as a boolean property.

Log in to reply