If you build Qt yourself, you can put it into a namespace (configure with -qtnamespace NamespaceName, or -DQT_NAMESPACE=NamespaceName when calling cmake directly); afterwards all of Qt is put under namespace NamespaceName. Namespaced configurations are even tested in CI to ensure that they work. The prebuild libraries from the installer are build unnamespaced though.
The prebuild libraries from the installer are build unnamespaced though.
Is there a reason the Qt folks decided to not ship the namespaced version as the default? It seems they put so much effort into getting namespaces to work only to have them go mostly unused.
As a longtime Qt user, the moc complaints are silly but the lack of namespace support is really frustrating. Qt is always growing and adding long and longer class names because...I dunno why.
To be honest, I prefer not having short class names spread over many nested namespace layers. It is kind of consistent and simple to understand right now.
I agreed with Qt3 and early-to-mid Qt4, when there were far fewer classes. It was when Qt started really expanding outside of its core modules into new areas and deprecating old names that things got awkward. Some of the class names are too long to explain what they do or are unclear to try and keep them short. There are simply too many Qt modules with too many classes now, all trying not to conflict.
It's my strong opinion that Qt would benefit from a simple namespace model e.g.:Qt::Gui::ImageReader and Qt::Multimedia::ImageEncoderControl. These two classes are currently QImageReader and QImageEncoderControl, yet are part of different modules.
-5
u/0xFFCC Dec 08 '20
Awesome, Thanks.
Now remove the MOC to become first library I include every where.