Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Custom compound property in QDesigner properties editor
Forum Updated to NodeBB v4.3 + New Features

Custom compound property in QDesigner properties editor

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
3 Posts 3 Posters 762 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Igor YI Offline
    Igor YI Offline
    Igor Y
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I haven't played with such a construct but I see several problems:

      1. MyProp is a Q_GADGET so it can't have Q_PROPERTY
      2. You didn't declare/register MyProp as a metatype usable by your application.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by Chris Kawa
        #3

        Only a subset of QVariant types are supported by the designer plugins. Scroll down here for a list.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved