[Solved] Qt Creator plugins
-
Could somebody please explain the reason why all classes that implement some Qt Creator plugin (Bookmarks, VcsBase, etc or a plugin template in Creator) are „hidden“ in two namespaces: „%plugin-name%“ and then „Internal“?
-
What else would you expect? The plugins have different namespaces in order to avoid ambiguities between them (and custom plugins). And afaik, the Internal namespace contains the implementation details that are not exported.
-
Yes, the presence of namespace „%plugin-name%“ is understandable in this way.
However, everything inside „%plugin-name%“ is as well inside „Internal“ (except constants, they are inside „%plugin-name%::Constants“). It looks a bit confusing.
-
[quote author="DSav" date="1307723676"]
However, everything inside „%plugin-name%“ is as well inside „Internal“ (except constants, they are inside „%plugin-name%::Constants“). It looks a bit confusing.[/quote]Not everything, just the classes that are not exported (have a look at the VCSBase Plugin for example, the classes in vcsbaseeditor are exported via VCSBASE_EXPORT and therefore not in the Internal namespace).
-
Yes, I wasn’t careful while looking through the sources.
As far as I undestood there’s only one reason not to „hide“ some class into the „Internal“ namespace: this class is exported by plugin „A“ for being imported by other plugins (those which would depend on „A“). And macros like ZZZZ_EXPORT are used in order to define whether to use Q_DECL_EXPORT or Q_DECL_IMPORT depending on what *.pro file is being built right now.
Is this correct?
-
Yes. The internal classes are not exported and can therefore not be used by any other plugin.
-
Ok, thank you for the answers a lot.
-
Glad I could help. And please add [Solved] in front of the title (by editing the first post).
-
Strictly speaking the Internal namespace is not needed: The internal symbols are hidden and unavailable to other plugins. This hiding happens by the classes not having the export macros. That they are also in the Internal namespace is not really relevant, but it makes it more clear which symbols are exported and which are not.
So if you ever stumble over an exported symbol in the Internal namespace: Please file a bug:-)
-
[deleted]