How to create functions with Qt Design Studio?
-
I have a page with a Flow Positioner and two buttons 'add' and 'remove'. When I click on 'Add' I would like a Rectangle (for now) to be added to the flow. When I click on 'remove' I want it to loop through the children in the flow and have it return a specific one but for now let's say it's the last one.
How do I do this in Qt Designer? It won't let me put a standalone function in the ui.qml file. It has an option to select a 'run function' event but if I can't create a function I cannot select it. I know the logic of the QML is supposed to be in a QML file rather than a UI.QML file but Designer is not creating regular QML files. I could create a QML file myself but don't know where in the dir structure it is supposed to go. Nor do I really want it in a separate file because I don't consider this 'business logic' I consider this 'UI logic'.
Apparently I am totally missing how this is supposed to work. Please help, thanks.
-
@Ronel_qtmaster Do you mean "Jump to the code"?
That just puts me in the UI.QML file which won't let me create a standalone function. And there is no "Designer Tab". There is a 2D tab.
I'm not in creator because I can't get it to work so I was told to use Design Studio in lieu of. I get an error "Functions are not supported in a UI file".
Sorry just noticed I made the wrong subject. It should say "How to create functions with Qt Design Studio". I fixed the subject line.
-
@Ronel_qtmaster So I can open the project in Qt Creator, add the code, then go back to Qt Design Studio and it won't give me the error? Very awkward.