[Qt-interest] Few queries on Q_PROPERTY() macro
Andre Somers
andre at familiesomers.nl
Thu Jul 1 16:40:12 CEST 2010
On 1-7-2010 15:44, Santhosh Y wrote:
> Hi ,
>
> Please see the following class, from which I would like to expose few
> more interfaces as part of COM object
> ======================================================================================
> // NewGUICOMObj - COM object ; It is derived from QObject, for
> adding Q_PROPERTY
> class NewGUICOMObj : public QObject
> {
> Q_OBJECT
> Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
> //This is I am able to write correctly; And also I am able to use from
> tester side using this com object
> * //Q1: What is wrong with the following Q_PROPERTY declaration*
> //Q_PROPERTY(char *path READ readPath WRITE setPath)
I would think the issue is that char* is not a registered type for
QVariant. There is a constructor for it, but it will result in a QString
being stored.
> public:
> // constructor
> NewGUICOMObj (char* p, QObject * parent = 0) : ptr_(p),
> QObject(parent)
> {
> }
> * //Q2: Following Method I would like to expose on COM
> object*. *Please tell me how to write using Q_PROPERTY*
> void RenewCallback(eOwner owner) {...........}
>
> * // Q3: Following Method also I would like to expose on COM
> object*. *Please tell me how to write using Q_PROPERTY*
> int createInstance ()
Ehhh?
Why would you want to expose these as properties? What's the point in
doing that? Judging by their names, they don't have property-semantics
either. The first would require a write-only property, and that is not
possible. Properties are things that you can read on a class instance,
and often also write. Q3 above looks like you want some kind of static
constructor for your class, and expose that as a property?
André
--
Nokia Certified Qt Developer.
Interested in Qt related job offers or freelance Qt consulting work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100701/e9bfd12a/attachment.html
More information about the Qt-interest-old
mailing list