Solved Custom compound property in QDesigner properties editor
-
Hello
Is there any way to show compound property of custom widget in QDesigner's property editor?
For example:class MyProp { Q_GADGET public: Q_PROPERTY(double a READ a WRITE setA) Q_PROPERTY(double b READ b WRITE setB) double a() const; double b() const; void setA(double); void setB(double); private: double m_a; double m_b; }; class MyWidget: public QWidget { Q_OBJECT public: Q_PROPERTY(MyProp prop READ prop WRITE setProp) MyProp prop() const; void setProp(const MyProp&); private: MyProp m_prop; };
I expected it would display as (for example) QSize property.
But QDesigner does not display prop in properties editor.(I've omitted part about qdesigner plugin to make question clearer)
Thanks in advance
-
Hi,
I haven't played with such a construct but I see several problems:
- MyProp is a Q_GADGET so it can't have Q_PROPERTY
- You didn't declare/register MyProp as a metatype usable by your application.
-
Only a subset of QVariant types are supported by the designer plugins. Scroll down here for a list.