Unsolved Regarding the exposing of the properties using Q_Property
-
@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.
-
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 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
andQObject::property
methods by name. There's no other automation put in place for you out of the box (you even need to cast theQVariant
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.
-
Hi,
Thanks for the reply.
will look into the property editor documentation of other software and then design the codeDesigner Plugin is only for Qt designer?.
Thanks,
-
@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.
-
@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 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.
-
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,
-
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?.as u have also had hands on WinCC OA, can u provide guidance?.
Thanks,
-
@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. ? -
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
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 :)
-
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
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?
- Can the user manually create and expose using Q_PROPERTY or any other way?.
-
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 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.
-
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
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. -
k thats what i am figuring what datatypr should i use to make Gedi understand , so i will get toolbutton and combobox.
Thanks,
-
@Pradeep-Kumar
Well the dude says it takes QColor, QPen, QBrush, QFont, QPoint
so I would just try and see what you get :)