[Qt-interest] Derive slots from non-Qt-based classes

Stefan Bisplinghoff bisplinghoff at hia.rwth-aachen.de
Tue Apr 28 17:43:36 CEST 2009


Ian Thomson schrieb:
> In the example code you posted, the Q_OBJECT macro is missing.

Hmm.. yes, it's missing in SomeDerivedClass.
Q_OBJECT in SomeBaseClass is not allowed as it doesn't inherit from
QObject. And I really don't want to inherit from QObject! :-)

To make things more clear:
I want to extend QWidget based classes with additional methods.
Implementing the stuff in a subclass derived from QWidget works fine for
QWidgets but using the same additional stuff with a QGLWidget is not
possible.

I understand that I cannot call the slot in SomeBaseClass as this has
not been moc'ed, but I think it may be possible to use the parent code
in SomeDerivedClass, which actually is moc'ed.

Regards,
 Stefan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090428/de5d6d5f/attachment.bin 


More information about the Qt-interest-old mailing list