QtPropertyBrowser not handling Q_PROPERTY Notify event
-
Starting with the example object_controller from qt-solutions I implemented a few objects with Q_PROPERTY attributes.
@
Q_PROPERTY(int ModuleId READ moduleId WRITE setModuleId NOTIFY moduleIdChanged)
@
Everything works except when I change the field programticly the PropertyBrowser doesn't update. The moduleIdChanged signal is emitted but nothing is attached. What could I be doing wrong.Leif
-
Welcome to DevNet!
Have you connected moduleIdChanged signal to any slots in the PropertyBrowser?
-
I am not sure I understand. I don't believe the QObjects that I am visualizing via the Property Browser contain such a signal. Maybe I am misunderstanding.
FYI this is the example I used to module my code around: https://qt.gitorious.org/qt-solutions/qt-solutions/source/fd22bee22274975c56f1c10d87ee9fd2c0818f83:qtpropertybrowser/examples/object_controller
-
[quote author="LeifZars" date="1407527414"]I implemented a few objects with Q_PROPERTY attributes.
@
Q_PROPERTY(int ModuleId READ moduleId WRITE setModuleId NOTIFY moduleIdChanged)
@
Everything works except when I change the field programticly the PropertyBrowser doesn't update. The moduleIdChanged signal is emitted but nothing is attached. What could I be doing wrong.
[/quote]You have implemented a signal that notifies about the changes in the objects.
To get these notifications in the property browser you need to connect the browser's slot to this signal. -
It was my imprecision that the PropertyBrowser automatically did that, but maybe not.
-
I don't think it is a generic property browser for any QObject based classes.
Do you use QtIntPropertyManager::addProperty() to add ModuleId to the properties hierarchy?
Have you implemented your property browser based on QtAbstractPropertyBrowser? -
"Here":http://doc.qt.digia.com/qq/qq18-propertybrowser.html is an article that explains the property browser framework.
-
Sorry for the long delay.
Yes I do use addProperty .
I am using QtTreePropertyBrowser, it is based on the QtAbstractPropertyBrowser.
The method I use, addClassProperties, is taken from object_controller qtPropertyBrowser example. It doesn't appear to handle change events, so I will have to add that.
-
I am also using QtVariantPropertyManager, it seems that I will have to modify this. I don't see how else I could connect the properties change signal to the managed widget.
-
I am having trouble determining how I should implement this. Any ideas.
Also per
http://www.wiki.crossplatform.ru/index.php/The_Property_Browser_Framework If you search for the word sync on that page, it says that the is internally handled.