QT Creator - Instantiating multiple elements/templates with callbacks and others
-
Hello everyone.
I started learning Qt and there are a few things I do not know how to approach:-
I come from a game development (Unity) environment and I am used to the concept of simple "prefabs" or "templates" with attached classes. I could not find anything similar to that besides "Custom Widgets", but these do not behave in a logical way (?). Custom Widgets, if I understood correctly, are separate projects by themselves; this makes them not really usable for small projects and such. This is what I want to do:
I have a Vertical Layout. Every time I click the button "Add Window", I want to instantiate a row with multiple buttons. Each button would end up calling a generic method by index (0, Total_Rows].
I thought of simply generating every element through code but this sounds extremely tedious and does not make a lot of sense considering there is a UI/Drag&Drop editor. It defeats the purpose of easily editing the looks of the app.
-
I have a few layouts and I would like to set their position through value just like I would with any other Widget but I dont get that in the Property Editor window. Is there a way of doing so?
-
Is it possible to make Widget elements to snap to the grid when moving them, not only when resizing? I find it very obnoxious to end up specifying the position values of labels & buttons through the Property Editor when I simply want to move them horizontally, for example.
I'd appreciate pointers/guidelines or references to specific documentation. I am not the sharpest tool in the shed and it is taking me a lot to learn Qt & C++ at the same time.
Thank you very much. -
-
Normally you don't set any fixed values for layouts or widgets so no - no snapping since not needed in the normal usecase.