On sexta-feira, 26 de outubro de 2012 07.42.01, d3fault wrote: > Weird, I thought all QObject derived classes required the Q_OBJECT > macro. What are the exact requirements for this? Only if you use > signals/slots in the derived class?
Yes. You need it if you use the features provided by the meta object, which are: - signals - slots - other Q_INVOKABLE - properties - Q_ENUM - Q_CLASSINFO - qobject_cast - any access to metaObject(), including registering in QtDBus, QML, QtScript, etc. Starting in Qt 5, things change a little. Due to the new connection mechanism, you do not need Q_OBJECT to connect an existing signal to anything. That means you can use existing Qt classes without using moc in your application, provided you do use the new mechanism. However, Qt plugins now require Q_OBJECT because moc generates some extra data that QPluginLoader needs to find. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
