Expose Q_PROPERTY variable in QT Designer?
-
Hello fellow QT'ers, I'm keeping myself busy lately reading the QT docs and trying out the different classes. Incredible stuff. I'm just wondering as I don't see this posted anywhere, is it possible to expose an int variable for example from a C++ class to QT Designer so I can set it in there?
I tried the following by adding it to the header file but I don't see it when I open QT Designer:
Q_PROPERTY(bool clickEnabled READ getClickEnabled WRITE setClickEnabled)
Thanks a million for the tips.
-
@Calicoder
You can add a property in the Property editor panel:
add-custom-propertiesOr create a plug-in:
adding-plugins -
@mpergand said in Expose Q_PROPERTY variable in QT Designer?:
@Calicoder
You can add a property in the Property editor panel:
add-custom-propertiesCool I'll give that a try.
Or create a plug-in:
adding-pluginsThis one intrigues me for sure, I see from the docs that this plugin is what is listed on the left side in Qt Designer right? Is it as simple as adding a Q_PROPERTY with a READ and WRITE to that same plugin?
Appreciate the tips btw, thanks!
-
@Calicoder
To create a plugin is a lot of work.
I tried a few years ago with Qt 5.3 or something and after working hard on it, I realised that on Mac it makes QCreator to crash that's all !
and only works with the stand-alone version of QDesigner.
So i gave up.
Anyway, for complex interfaces, i'm building all by code, overall is much easier if you have many custom widgets with a lot of properties to set.
I'm using QDesigner only for simple interfaces with standard widgets like Preferences dialog and things like that. -
@mpergand That's good to know, I'll stick with using dynamic properties after all. Thinking I would have to add these manually to each widget I want? Couldn't be as easy as setting a dynamic property for say a class and use that and have it show up in Qt Designer.