Hacker News new | past | comments | ask | show | jobs | submit login

It is called the Meta Object Compiler (moc). You can read more about it here: https://doc.qt.io/qt-6/why-moc.html

It parses your C++ headers to generate helpful metadata used for runtime reflection and slot-and-signals. All the generated code is C++.

The latest versions of CMake support moc out of the box, so developers hardly notice the moc step.




So Qt doesn't work without moc, right?


It used to be much more involved in the past. Of course you could hand write the code, but as it was originally I believe a preprocessor was the only way to sensibly write signal support, something that AFAIK stopped being true around 2003 but by then moc was entrenched.


PyQt and PySide (both Python libraries that allow you to use Qt libraries) do not required you to use 'moc'.


No, it is possible to hand code everything that moc generates.


And PyQt generates that metadata to make signals work?




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: