[Qt-interest] Comparing two QMetaObjects
Gustavo de Sá Carvalho Honorato
gustavohonorato at gmail.com
Mon Feb 7 14:45:07 CET 2011
On Sun, Feb 6, 2011 at 8:50 PM, Thiago Macieira <thiago at kde.org> wrote:
>
> On Friday, 4 de February de 2011 19:35:56 Gustavo de Sį Carvalho Honorato
> wrote:
> > Hi,
> >
> > What is the best way to compare two QMetaObjects? I've tried this, but
> > did not work:
> >
> > object->metaObject() ! QObject::staticMetaObject
>
> metaObject() returns a QMetaObject*
>
> staticMetaObject is a QMetaObject.
Err... I see now that I made a silly question. I didn't saw that I was
comparing pointers with classes.
>
> You can't compare a struct to a pointer. Either compare struct to struct (if
> they have operator) or pointer to pointer.
>
> For QMetaObject, simply compare pointers.
Suppose I have a object 'a' of a class 'A'. It is guaranteed that
a->metaObject() will aways return a pointer to A::staticMetaObject?
Then I can aways compare using:
a->metaObject() != &A::staticMetaObject ?
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Senior Product Manager - Nokia, Qt Development Frameworks
> PGP/GPG: 0x6EF45358; fingerprint:
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
More information about the Qt-interest-old
mailing list