Custom Widget Class Properties
-
wrote on 10 Sept 2015, 08:50 last edited by Andy314 9 Oct 2015, 08:54
Hello !
I need some widgets derived from some standard wigets with similar additional functionality (same Properties).
My first idea was templates, but a QObject template is not possible.
Now I try to integrate all poperties in a QObject subclass. The custom wiget gets this class property with inclusive its subproberties.
Is this possible ? Can I get a entry in the property explorer, which shows in expanding mode the subproperties similar to the Font property.
I tried this, butTPropTest itsPropTest; // a QObject class with properties Q_PROPERTY(TPropTest PropTest READ readPropTest) TPropTest readPropTest() { return itsPropTest; }
The problem is that a QObject has no copyconstructor.
What can I do ???? -
Hi,
You have to use a pointer to your QObject if you want to use it like that
-
wrote on 10 Sept 2015, 09:04 last edited by
TPropTest itsPropTest; Q_PROPERTY(TPropTest* PropTest READ readPropTest) TPropTest* readPropTest() { return &itsPropTest; }
This shows no PropTest in the explorer.
Must I integrate a setter for the whole class ? and how ? -
I missed the point about the Property Explorer, I'm really not sure it can handle an embedded object like that.
The setter follows the same logic as any other property:
setReadPropTest(TPropTest *tPropTest);
1/4