Details
-
Suggestion
-
Resolution: Unresolved
-
P4: Low
-
None
-
5.2.1
-
None
-
All
Description
When first starting out in QT you run across QT_BEGIN_NAMESPACE right away. It's not at all obvious what this does or how to find out about it. Even after looking it up in qglobal.h it's hard to discern what the best practice for using these defines would be. In addition when looking at the example code these defines often seem to be improperly used. For example:
In the activeqt\dotnet\wrapper\lib\tools.h (chosen at random because it was simple) you'll see the following:
QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE System::String *QStringToString(const QString &qstring); QString StringToQString(System::String *string); #endif // TOOLS_H
I don't see how this would compile if Qt were actually in a namespace. The forward declaration of the class QString is correct but the usage as a parameter to QStringToString() is not. It looks to me like the example should be:
System::String *QStringToString(const QT_PREPEND_NAMESPACE(QString) &qstring);
That said, I'm still unclear as to whether users should even bother trying to make their code immune to Qt being inside a namespace or not. Some official documentation and recommendations would be much appreciated.