PDA

View Full Version : Q_property



micky
12th April 2012, 19:24
Hi,

I'm writing a Custom Widget for QtCreator/-Designer. Things work fine, BUT I have difficulties to create properties for the Property-
Editor. Simple properties like INTs, BOOLs, ... work fine (with Q_PROPERTY), but I would like to bundle some properties that belong together into a subproperty
like in QWidget:
v-geometry
| |-X
| |-Y
| |-Width
| |-Height
|
I've also tried to find a solution with Q_FLAGS but a so declared enum wouldn't even show up in the Property-Editor

The other point is that when I create a QString property such subproperties are created automatically (translation, ...). Does somebody know how I can get rid if them?

Any suggestions, example code, ... ?

Thanx in advance

Michael

high_flyer
12th April 2012, 20:40
see QDesignerCustomWidgetInterface::domXml() and its usage in the custom plugin example:
http://qt-project.org/doc/qt-4.8/designer-customwidgetplugin.html

micky
23rd April 2012, 19:51
Hi,

thanks for your reply. I tried to use the domXML-function to create new properties and it works for strings. When using 'cstring' as datatyp-element I even get rid of the sub-properties translation, etc.
But I cannot create a 'set'-property. As described in http://www.kde.gr.jp/~ichi/qt/designer-manual-15.html it should be possible to create a set-property with

<set>AlignLeft|AlignTop</set>

But if I specify this in my domXML() method this property is silently ignored by QTDesigner

Can anybody tell me where the problem is?