[Qt-interest] Q_PROPERTIES not visible in QMetaObject
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Wed Oct 5 01:11:28 CEST 2011
Hi Robert,
I'm not sure, but have a look at the docs for Q_DECLARE_METATYPE and
qRegisterMetaType again - the examples there do not include the *.
Hope that helps,
Tony
From: qt-interest-bounces+tony.rietwyk=rightsoft.com.au at qt.nokia.com
[mailto:qt-interest-bounces+tony.rietwyk=rightsoft.com.au at qt.nokia.com] On
Behalf Of Schimkowitsch Robert
Sent: Wednesday, 5 October 2011 3:15 AM
To: qt-interest at qt.nokia.com
Subject: [Qt-interest] Q_PROPERTIES not visible in QMetaObject
I have declared a couple of properties in an QObject-subclass, but they do
not become visible when iterating through all QMetaObject's properties.
I have the class:
class CPel_PictureElement : public CPel_ContainerElement
{
Q_OBJECT
Q_INTERFACES(IPel_Element)
Q_PROPERTY(QString PictureName READ pictureName WRITE setPictureName)
Q_PROPERTY(QString PictureAuthor READ pictureAuthor WRITE
setPictureAuthor)
// Constructors, Methods and Members
}
Q_DECLARE_METATYPE(CPel_PictureElement*)
CPel_ContainerElement, a QGraphicsWidget, and thereby a QObject subclass.
(It is also a subclass of a registered interface called IPel_Element)).
The class is compiled within a static library (.a-file using MinGW), and
used in an executable.
There I attempt to read the property information this way:
CPel_PictureElement* pic = new CPel_PictureElement();
for ( int i = 0; i < pic->metaObject()->propertyCount();
++i)
{
qDebug() << pic->metaObject()->property(i).name();
}
I only get the properties up to QGraphicsWidget, not the two properties I
have defined.
I have also tried manually calling
qRegisterMetaType<CPel_PictureElement*>();
- doesn't change anything.
Any ideas what might be wrong here?
Kind regards
Robert Schimkowitsch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111005/733050c7/attachment.html
More information about the Qt-interest-old
mailing list