Qt plugin does not handle class with same name and different folders/namespaces
I'm creating in Visual Studio a Qt project with the Qt plugin version 1.2.4.
This is my folder structure:
|-Class.h -- It defines Class
|-Class.h -- It defines Private::Class
In src/Class.h I use the pimpl idion in order to use Private::Class and putting here logic.
Both Class and Private::Class are qobjects, so I declare Q_OBJECT in both headers. But the plugin creates only one moc header. It creates moc_Class.cpp in both cases and mocs overwrite each other.
I there a way to handle with the qt plugin different classes in different folders and namespace but with the same name, or I must be forced to use unique names for all classes of my project?
Unfortunately the meta-object compiler doesn't handle namespaces.
This has been discussed before, and some workarounds proposed: http://www.qtcentre.org/threads/6753-moc-with-same-file-names
I understand. Then I'll check filenames in order to avoid collisions. If I want to study this feature and try to find a way for moc to handle namespaces and/or folders, which file I should check in Qt source? moc.cpp or another one?
[quote author="jepessen" date="1422779586"]If I want to study this feature and try to find a way for moc to handle namespaces and/or folders, which file I should check in Qt source? moc.cpp or another one?[/quote]I'm not completely sure myself, but I'm guessing you'd need to look at a few different files in the moc folder: https://qt.gitorious.org/qt/qtbase/source/src/tools/moc/
If you'd like to talk to the Qt engineers about this (e.g. to show them your proposal and/or ask for advice), subscribe and post to the "Development mailing list":http://lists.qt-project.org/mailman/listinfo/development