[Qt-interest] Q_PROPERTIES not visible in QMetaObject

Schimkowitsch Robert Robert.Schimkowitsch at andritz.com
Wed Oct 5 07:52:04 CEST 2011


No way I could declare the metatype without the *.
 
As Q_DECLARE_METATYPE documentation says:
"This macro makes the type Type known to QMetaType as long as it
provides a public default constructor, a public copy constructor and a
public destructor."
 
and as QObject documentation says:
"QObject has neither a copy constructor nor an assignment operator. This
is by design. Actually, they are declared, but in a private section with
the macro Q_DISABLE_COPY()."
 
Since I am a QObject subclass, I cannot have a copy constructor, hence I
can only declare the metatype to <MyClass>*
 
Kind regards

Robert Schimkowitsch 



________________________________

From: qt-interest-bounces+robert.schimkowitsch=andritz.com at qt.nokia.com
[mailto:qt-interest-bounces+robert.schimkowitsch=andritz.com at qt.nokia.co
m] On Behalf Of Tony Rietwyk
Sent: Wednesday, October 05, 2011 1:11 AM
To: qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] Q_PROPERTIES not visible in QMetaObject



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 

#####################################################################################
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/20111005/d56351c2/attachment.html 


More information about the Qt-interest-old mailing list