Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Regarding the exposing of the properties using Q_Property
Forum Updated to NodeBB v4.3 + New Features

Regarding the exposing of the properties using Q_Property

Scheduled Pinned Locked Moved Unsolved General and Desktop
39 Posts 4 Posters 12.9k Views 4 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.
  • Pradeep KumarP Offline
    Pradeep KumarP Offline
    Pradeep Kumar
    wrote on last edited by Pradeep Kumar
    #8

    Hi,

    The following code is compiling but the QLineEdit is not getting exposed to property editor,
    i even used DESIGNABLE true .

    I have the class inherited from QWidget.

    QLineEdit *m_lineEditValue;
    

    void MyWidget::setLineeditValue(QLineEdit *refValue)
    {
    m_lineEditValue = refValue;
    }

    QLineEdit *MyWidget::getLineEditValue()
    {
    return m_lineEditValue;
    }

    Q_PROPERTY(QLineEdit *getlineEditValue READ getLineEditValue WRITE setLineeditValue)

    What may be the issue?.

    Thanks,

    Pradeep Kumar
    Qt,QML Developer

    1 Reply Last reply
    0
    • Pradeep KumarP Offline
      Pradeep KumarP Offline
      Pradeep Kumar
      wrote on last edited by
      #9

      Hi,

      As i want to expose properties i require the objects like QLinedit,QComboBox.

      Link is provided below.
      https://postimg.org/image/iusdou5dz/

      i want the button which i marked in red similar in Qt, how can i achieve that?.

      Thanks,

      Pradeep Kumar
      Qt,QML Developer

      kshegunovK 1 Reply Last reply
      0
      • Pradeep KumarP Pradeep Kumar

        Hi,

        As i want to expose properties i require the objects like QLinedit,QComboBox.

        Link is provided below.
        https://postimg.org/image/iusdou5dz/

        i want the button which i marked in red similar in Qt, how can i achieve that?.

        Thanks,

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #10

        @Pradeep-Kumar said in Regarding the exposing of the properties using Q_Property:

        i want the button which i marked in red similar in Qt, how can i achieve that?.

        You want these properties to be available in designer? If I'm not mistaken, the only way to do that is to write a designer plugin, so the problem is not with exposing the properties of the objects per se.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        1
        • Pradeep KumarP Offline
          Pradeep KumarP Offline
          Pradeep Kumar
          wrote on last edited by
          #11

          Hi,

          I want the properties of ComboBox and ToolButton in Property editor of another client , i am integrating the Qt with another client so, i tried the above mentioned answer of QLineEdit and tried for QComboBox, it didnt expose, should i use designer plugin and how?.

          Thanks,

          Pradeep Kumar
          Qt,QML Developer

          kshegunovK 1 Reply Last reply
          0
          • Pradeep KumarP Pradeep Kumar

            Hi,

            I want the properties of ComboBox and ToolButton in Property editor of another client , i am integrating the Qt with another client so, i tried the above mentioned answer of QLineEdit and tried for QComboBox, it didnt expose, should i use designer plugin and how?.

            Thanks,

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #12

            @Pradeep-Kumar said in Regarding the exposing of the properties using Q_Property:

            it didnt expose

            How do you discern that? To "expose" a property means that it's available through the QObject::setProperty and QObject::property methods by name. There's no other automation put in place for you out of the box (you even need to cast the QVariant you get from those manually), so if you're after a property editor you need to code that yourself.

            @Pradeep-Kumar said in Regarding the exposing of the properties using Q_Property:

            should i use designer plugin and how?.

            I have no idea what that other editor is, but as I said you need to use a designer plugin only if you intend to make your code available to designer. As for other property editors, you have to look up their documentation to discover how they handle object properties, and how to integrate Qt with them.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • Pradeep KumarP Offline
              Pradeep KumarP Offline
              Pradeep Kumar
              wrote on last edited by
              #13

              Hi,

              Thanks for the reply.
              will look into the property editor documentation of other software and then design the code

              Designer Plugin is only for Qt designer?.

              Thanks,

              Pradeep Kumar
              Qt,QML Developer

              kshegunovK 1 Reply Last reply
              0
              • Pradeep KumarP Pradeep Kumar

                Hi,

                Thanks for the reply.
                will look into the property editor documentation of other software and then design the code

                Designer Plugin is only for Qt designer?.

                Thanks,

                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by
                #14

                @Pradeep-Kumar said in Regarding the exposing of the properties using Q_Property:

                Designer Plugin is only for Qt designer?.

                Yes. QtCreator uses plugins for different functionality (it's basically one big plugin loader). So you need to provide a designer plugin only if you intend to integrate your code in the designer itself.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • kshegunovK kshegunov

                  The problem is you're trying to assign reference to an object (which basically means calling the copy constructor, which is not allowed on QObject subclasses). It should go like this:

                  class MyClass : public QObject
                  {
                  public:
                      Q_OBJECT
                      Q_PROPERTY(QLineEdit * lineEditValue READ lineEditValue WRITE setLineEditValue)
                  
                      void setLineEditValue(QLineEdit * value)
                      {
                          m_lineEditValue = value;
                      }
                  
                      QLineEdit * lineEditValue() const
                      {
                          return m_lineEditValue;
                      }
                  
                  private:
                      QLineEdit * m_lineEditValue;
                  };
                  

                  Kind regards.

                  Pradeep KumarP Offline
                  Pradeep KumarP Offline
                  Pradeep Kumar
                  wrote on last edited by
                  #15

                  @kshegunov said in Regarding the exposing of the properties using Q_Property:

                  The problem is you're trying to assign reference to an object (which basically means calling the copy constructor, which is not allowed on QObject subclasses). It should go like this:

                  class MyClass : public QObject
                  {
                  public:
                      Q_OBJECT
                      Q_PROPERTY(QLineEdit * lineEditValue READ lineEditValue WRITE setLineEditValue)
                  
                      void setLineEditValue(QLineEdit * value)
                      {
                          m_lineEditValue = value;
                      }
                  
                      QLineEdit * lineEditValue() const
                      {
                          return m_lineEditValue;
                      }
                  
                  private:
                      QLineEdit * m_lineEditValue;
                  };
                  

                  Can u explain what will be the scenario if we try to send the reference in Q_PROPERTY.
                  like QLineEdit,QComboBox etc.

                  Thanks,

                  Pradeep Kumar
                  Qt,QML Developer

                  kshegunovK 1 Reply Last reply
                  0
                  • Pradeep KumarP Pradeep Kumar

                    @kshegunov said in Regarding the exposing of the properties using Q_Property:

                    The problem is you're trying to assign reference to an object (which basically means calling the copy constructor, which is not allowed on QObject subclasses). It should go like this:

                    class MyClass : public QObject
                    {
                    public:
                        Q_OBJECT
                        Q_PROPERTY(QLineEdit * lineEditValue READ lineEditValue WRITE setLineEditValue)
                    
                        void setLineEditValue(QLineEdit * value)
                        {
                            m_lineEditValue = value;
                        }
                    
                        QLineEdit * lineEditValue() const
                        {
                            return m_lineEditValue;
                        }
                    
                    private:
                        QLineEdit * m_lineEditValue;
                    };
                    

                    Can u explain what will be the scenario if we try to send the reference in Q_PROPERTY.
                    like QLineEdit,QComboBox etc.

                    Thanks,

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by kshegunov
                    #16

                    @Pradeep-Kumar said in Regarding the exposing of the properties using Q_Property:

                    Can u explain what will be the scenario if we try to send the reference in Q_PROPERTY.

                    You can't. References can't be assigned, meaning this is ill formed:

                    AnyClass & ref;
                    AnyClass object;
                    
                    ref = object; //< Wrong! Not allowed. (C++)
                    

                    You also can't pass those objects by value, because QObject doesn't allow copying. The following is wrong too:

                    QObject a, b;
                    a = b; //< Wrong! Not allowed. (Qt)
                    

                    You're pretty much stuck to using pointers.

                    Read and abide by the Qt Code of Conduct

                    1 Reply Last reply
                    1
                    • Pradeep KumarP Offline
                      Pradeep KumarP Offline
                      Pradeep Kumar
                      wrote on last edited by
                      #17

                      k,

                      can u explain what will be the result of the code which u helped me to go through with having below.

                      class MyClass : public QObject
                      {
                      public:
                          Q_OBJECT
                          Q_PROPERTY(QLineEdit * lineEditValue READ lineEditValue WRITE setLineEditValue)
                      
                          void setLineEditValue(QLineEdit * value)
                          {
                              m_lineEditValue = value;
                          }
                      
                          QLineEdit * lineEditValue() const
                          {
                              return m_lineEditValue;
                          }
                      
                      private:
                          QLineEdit * m_lineEditValue;
                      };
                      

                      Thanks,

                      Pradeep Kumar
                      Qt,QML Developer

                      1 Reply Last reply
                      0
                      • Pradeep KumarP Offline
                        Pradeep KumarP Offline
                        Pradeep Kumar
                        wrote on last edited by
                        #18

                        Hi,

                        I am using the

                        Q_PROPERTY( QBrush brush READ getBrush WRITE setBrush DESIGNABLE true)
                        to expose property to the property editor of client (not Qt designer.)

                        How the toolbutton is present can anyone explain, how the tolbutton is provided at the end of the property?.
                        Is this the custom widget implemented or Qt has provided the toobutton for QBrush?.

                        @mrjj

                        as u have also had hands on WinCC OA, can u provide guidance?.

                        Thanks,

                        Pradeep Kumar
                        Qt,QML Developer

                        mrjjM 1 Reply Last reply
                        0
                        • Pradeep KumarP Pradeep Kumar

                          Hi,

                          I am using the

                          Q_PROPERTY( QBrush brush READ getBrush WRITE setBrush DESIGNABLE true)
                          to expose property to the property editor of client (not Qt designer.)

                          How the toolbutton is present can anyone explain, how the tolbutton is provided at the end of the property?.
                          Is this the custom widget implemented or Qt has provided the toobutton for QBrush?.

                          @mrjj

                          as u have also had hands on WinCC OA, can u provide guidance?.

                          Thanks,

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #19

                          @Pradeep-Kumar
                          Hi
                          Sadly I have never tried integrated anyting in the winCC editor.
                          So it seems its made in Qt also ? only way it could ever understand
                          a Qt property.

                          "How the toolbutton is present can anyone explain, how the tolbutton is provided at the end of the property?."

                          Im sorry , but Im not understanding what you are asking.
                          This is just a brush so there is no button there.

                          Can you show some pictures ( of what you mean/have)
                          and may a ref to the doc of
                          integration. ?

                          1 Reply Last reply
                          1
                          • Pradeep KumarP Offline
                            Pradeep KumarP Offline
                            Pradeep Kumar
                            wrote on last edited by Pradeep Kumar
                            #20

                            Hi,

                            below link

                            https://postimg.org/image/iusdou5dz/

                            where we use
                            Q_PROPERTY( QBrush brush READ getBrush WRITE setBrush DESIGNABLE true)

                            property name is brush value we can see solid and in side their is toolbutton,
                            how it is exposed?.

                            Thanks,

                            Pradeep Kumar
                            Qt,QML Developer

                            mrjjM 1 Reply Last reply
                            0
                            • Pradeep KumarP Pradeep Kumar

                              Hi,

                              below link

                              https://postimg.org/image/iusdou5dz/

                              where we use
                              Q_PROPERTY( QBrush brush READ getBrush WRITE setBrush DESIGNABLE true)

                              property name is brush value we can see solid and in side their is toolbutton,
                              how it is exposed?.

                              Thanks,

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #21

                              @Pradeep-Kumar
                              Hi, that is not part of the QBrush. That is
                              part of the editor. Some sort of color picker.

                              The documentation for the Editor should clearly state the requirements of
                              making an add-in and allow properties to be edited.

                              Since this is NOT Creator, we cannot know how to do it but siemens will :)

                              1 Reply Last reply
                              0
                              • Pradeep KumarP Offline
                                Pradeep KumarP Offline
                                Pradeep Kumar
                                wrote on last edited by Pradeep Kumar
                                #22

                                i was going through another link

                                https://doc.qt.io/archives/qq/qq18-propertybrowser.html

                                in
                                Extending the Framework section , they have property name and value, with spinbox , combobox, toolbutton.

                                Can the user manually create and expose using Q_PROPERTY or any other way?.

                                I want toolbutton and combobox in value column of property editor , how can it be acheived?.

                                Thanks,

                                Pradeep Kumar
                                Qt,QML Developer

                                mrjjM 1 Reply Last reply
                                0
                                • Pradeep KumarP Pradeep Kumar

                                  i was going through another link

                                  https://doc.qt.io/archives/qq/qq18-propertybrowser.html

                                  in
                                  Extending the Framework section , they have property name and value, with spinbox , combobox, toolbutton.

                                  Can the user manually create and expose using Q_PROPERTY or any other way?.

                                  I want toolbutton and combobox in value column of property editor , how can it be acheived?.

                                  Thanks,

                                  mrjjM Offline
                                  mrjjM Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #23

                                  @Pradeep-Kumar
                                  Hi
                                  Yes those samples are example of writing a property editor for us use in own program.
                                  Just like Creator has its own.

                                  But this is for Qt. Are you not talking about
                                  integrating inside another program from siemens ( some editor)?
                                  Not your own own code / program ?

                                  • Can the user manually create and expose using Q_PROPERTY or any other way?.
                                    Where do you mean ? Expose from where ?
                                    In Qt and Creator, this is exported via DLLS/Plugins so user can make a custom plugin for Creator.

                                  Where are you trying to export something? and to what?

                                  1 Reply Last reply
                                  0
                                  • Pradeep KumarP Offline
                                    Pradeep KumarP Offline
                                    Pradeep Kumar
                                    wrote on last edited by
                                    #24

                                    k let me make understand .

                                    i want to add toolbutton and combobox visual elements from Qt code to WinnCC OA property editor.
                                    When i add as ewo to WinCC OA, i want the property value to show toolbutton and combobox. so the user can select the items in combobox and click to show dialog on toolbutton.

                                    Thanks,

                                    Pradeep Kumar
                                    Qt,QML Developer

                                    mrjjM 1 Reply Last reply
                                    0
                                    • Pradeep KumarP Pradeep Kumar

                                      k let me make understand .

                                      i want to add toolbutton and combobox visual elements from Qt code to WinnCC OA property editor.
                                      When i add as ewo to WinCC OA, i want the property value to show toolbutton and combobox. so the user can select the items in combobox and click to show dialog on toolbutton.

                                      Thanks,

                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #25

                                      @Pradeep-Kumar said in Regarding the exposing of the properties using Q_Property:

                                      WinnCC OA property editor.

                                      Yes so you must use WinnCC OA documentation to do so.

                                      How can WinnCC OA property editor even see you object ?

                                      Did you made a plugin for it ?

                                      Qt cannot do this for you. Its WinnCC OA that must , if its even possible.

                                      1 Reply Last reply
                                      0
                                      • Pradeep KumarP Offline
                                        Pradeep KumarP Offline
                                        Pradeep Kumar
                                        wrote on last edited by
                                        #26

                                        Hi,

                                        Posted the same query in WinCC OA forum

                                        the below is the link

                                        https://portal.etm.at/index.php?option=com_kunena&Itemid=75&func=view&catid=16&id=4804#4819

                                        They said its automatically done by Gedi.
                                        and going through the documentation, and how to provide the properties as string , QVariant so the gedi understands?.

                                        Thanks,

                                        Pradeep Kumar
                                        Qt,QML Developer

                                        mrjjM 1 Reply Last reply
                                        0
                                        • Pradeep KumarP Pradeep Kumar

                                          Hi,

                                          Posted the same query in WinCC OA forum

                                          the below is the link

                                          https://portal.etm.at/index.php?option=com_kunena&Itemid=75&func=view&catid=16&id=4804#4819

                                          They said its automatically done by Gedi.
                                          and going through the documentation, and how to provide the properties as string , QVariant so the gedi understands?.

                                          Thanks,

                                          mrjjM Offline
                                          mrjjM Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #27

                                          @Pradeep-Kumar
                                          Ok so no QStringList for us.
                                          Then yes, seems it just need to be normal Qt properties ( with Q_PROPERTY)
                                          and Gedi ( what ever that is) should just do it.

                                          1 Reply Last reply
                                          0

                                          • Login

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