PDA

View Full Version : Can Custom Data types in Own Widget Plugin be shown Designer Property Window?



umituzun84
5th March 2010, 08:00
Hi All,

I want to create my own data type and want to use in my own custom widget plugin and show in Designer's Property window by using in Q_PROPERTY() declaration in my plugin.

For example if I have custom data types like below;
typedef QMap<int,QVariant> MyType;
Could I create Q_PROPERTY in my widget plugin and can see from Designer's property windows.

Is this possible or not?
If possible how can I achieve?

Regards.
Thanks in advance.

wysota
5th March 2010, 13:00
It's quite a complex situation. It is easier to have a context menu entry in Designer to edit such entries. You can take a look at the "Task Menu Extension Example" in the docs on how to do that. As for seeing the property in Designer - it should be possible but I'm not able to tell you how without investigating in Designer source code.

high_flyer
5th March 2010, 14:18
I don't know for sure, but it might work if you register the type with Qt:
http://doc.trolltech.com/4.6/custom-types.html

umituzun84
5th March 2010, 15:15
It's quite a complex situation. It is easier to have a context menu entry in Designer to edit such entries. You can take a look at the "Task Menu Extension Example" in the docs on how to do that. As for seeing the property in Designer - it should be possible but I'm not able to tell you how without investigating in Designer source code.

Thanks so much for your explanation wysota. I have thought same Task Menu Extension method, but thought if there is much easier way or not. So I will use task menu instead of investigation of Designer source code.

Regards.:)

umituzun84
5th March 2010, 15:20
I don't know for sure, but it might work if you register the type with Qt:
http://doc.trolltech.com/4.6/custom-types.html

Thanks high_flyer. But after I looked documents I see that, Q_DECLARE_METATYPE() macro help us while using own type in QVariant type for signal&slot and QObject::property, setProperty and etc usefull situation but not support designable extension for designer's property windows.
If you think opposite thought please let me now it support for designer window too or not?

Regards. :)