2 ms·
I haven't looked at Qt in a long while. Do they still have the MOC?
by ajasmin 14y ago
I haven't looked at Qt in a long while. Do they still have the MOC?
- pkmays 14y agoYes, Qt still uses moc. I leave it up to you to decide if that's a good thing or a bad thing.
- ajasmin 14y agoI certainly don't think it's a bad thing. Seems like without a MOC the programmer would have to write more code or file all that meta data in a separate file. So it's all good. I was just curious since I haven't touched Qt in years and this post implies it is moving toward more standard C++.
- deleted 14y ago[deleted]
- FigBug 14y agoYes, it's still used for several reasons, including: - enumerate the properties, signals, slots and other methods as well as decorations (classinfo) present in a class (this feature is called “type reflection”, which is common in scripted languages, but is also present in Java) - get and set properties by name and without knowing th exact type of the property (though technically the latter is a product of the related, but independent Meta Type system) - place calls to extracted member functions (the “invokable” functions) by name - the last two features together allow us also to integrate C++ classes easily with other languages and IPC mechanisms without the need to write specialised parsers (D-Bus, EcmaScript, QML, but also the many bindings to Qt like Python or C#) - instantiate types by simply having access to the meta object