Fix static plugins for classes in namespaces.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Thu, 30 Aug 2012 09:27:36 +0000 (11:27 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 30 Aug 2012 11:51:22 +0000 (13:51 +0200)
Breakage introduced by 819d0203e6fd9d27dc4c22e8c3cb8b437998f62a .

Extend QT_MOC_EXPORT to take the unqualified class name
as well for the function names.

Change-Id: I736097b564caa37c522d723780663d03341f9032
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Lukas Geyer <lgeyer@gmx.at>
src/corelib/plugin/qplugin.h
src/tools/moc/generator.cpp

index 634663b..c6b761c 100644 (file)
@@ -107,18 +107,18 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
 
 #if defined(QT_STATICPLUGIN)
 
-#  define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS) \
-    static QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGINCLASS() \
+#  define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \
+    static QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGINCLASSNAME() \
     Q_PLUGIN_INSTANCE(PLUGINCLASS) \
-    static const char *qt_plugin_query_metadata_##PLUGINCLASS() { return (const char *)qt_pluginMetaData; } \
-    const QT_PREPEND_NAMESPACE(QStaticPlugin) qt_static_plugin_##PLUGINCLASS() { \
-        QT_PREPEND_NAMESPACE(QStaticPlugin) plugin = { qt_plugin_instance_##PLUGINCLASS, qt_plugin_query_metadata_##PLUGINCLASS}; \
+    static const char *qt_plugin_query_metadata_##PLUGINCLASSNAME() { return (const char *)qt_pluginMetaData; } \
+    const QT_PREPEND_NAMESPACE(QStaticPlugin) qt_static_plugin_##PLUGINCLASSNAME() { \
+        QT_PREPEND_NAMESPACE(QStaticPlugin) plugin = { qt_plugin_instance_##PLUGINCLASSNAME, qt_plugin_query_metadata_##PLUGINCLASSNAME}; \
         return plugin; \
     }
 
 #else
 
-#  define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS)      \
+#  define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME)      \
             Q_EXTERN_C Q_DECL_EXPORT \
             const char *qt_plugin_query_metadata() \
             { return (const char *)qt_pluginMetaData; } \
index ccc73c1..6aaefc4 100644 (file)
@@ -1452,7 +1452,8 @@ void Generator::generatePluginMetaData()
     int pos = cdef->qualified.indexOf("::");
     for ( ; pos != -1 ; pos = cdef->qualified.indexOf("::", pos + 2) )
         fprintf(out, "using namespace %s;\n", cdef->qualified.left(pos).constData());
-    fprintf(out, "QT_MOC_EXPORT_PLUGIN(%s)\n\n", cdef->qualified.constData());
+    fprintf(out, "QT_MOC_EXPORT_PLUGIN(%s, %s)\n\n",
+            cdef->qualified.constData(), cdef->classname.constData());
 }
 
 QT_END_NAMESPACE