[Qt-interest] Q_PROPERTIES not visible in QMetaObject

Schimkowitsch Robert Robert.Schimkowitsch at andritz.com
Tue Oct 4 18:14:31 CEST 2011


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

#####################################################################################
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
Thank You.
  ANDRITZ HYDRO GmbH
  Rechtsform/ Legal form: Gesellschaft mit beschrankter Haftung / Corporation 
  Firmensitz/ Registered seat: Wien 
  Firmenbuchgericht/ Court of registry: Handelsgericht Wien 
  Firmenbuchnummer/ Company registration: FN 61833 g
  DVR: 0605077 
  UID-Nr.: ATU14756806
#####################################################################################

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111004/db872421/attachment.html 


More information about the Qt-interest-old mailing list