Q_DECLARE_INTERFACE use fixes

this is incomplete, there are still some nested namespaced ones in the gui
component but this should be enoguh to build kdecore for now (with some
fixes for it too but unrelated to Q_DECLARE_INTERFACE) as a testing ground
for the namespacing work

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2017-05-09 06:54:24 +00:00
parent 3fd33f6641
commit 65a18c610d
10 changed files with 33 additions and 12 deletions

View file

@ -58,10 +58,12 @@ struct Q_CORE_EXPORT QTextCodecFactoryInterface : public QFactoryInterface
virtual QTextCodec *create(const QString &key) = 0; virtual QTextCodec *create(const QString &key) = 0;
}; };
#define QTextCodecFactoryInterface_iid "com.trolltech.Qt.QTextCodecFactoryInterface" QT_END_NAMESPACE
#define QTextCodecFactoryInterface_iid "com.trolltech.Qt.QTextCodecFactoryInterface"
Q_DECLARE_INTERFACE(QTextCodecFactoryInterface, QTextCodecFactoryInterface_iid) Q_DECLARE_INTERFACE(QTextCodecFactoryInterface, QTextCodecFactoryInterface_iid)
QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QTextCodecPlugin : public QObject, public QTextCodecFactoryInterface class Q_CORE_EXPORT QTextCodecPlugin : public QObject, public QTextCodecFactoryInterface
{ {

View file

@ -271,12 +271,14 @@ template <class T> inline const char * qobject_interface_iid()
#ifndef Q_MOC_RUN #ifndef Q_MOC_RUN
# define Q_DECLARE_INTERFACE(IFace, IId) \ # define Q_DECLARE_INTERFACE(IFace, IId) \
QT_BEGIN_NAMESPACE \
template <> inline const char *qobject_interface_iid<IFace *>() \ template <> inline const char *qobject_interface_iid<IFace *>() \
{ return IId; } \ { return IId; } \
template <> inline IFace *qobject_cast<IFace *>(QObject *object) \ template <> inline IFace *qobject_cast<IFace *>(QObject *object) \
{ return reinterpret_cast<IFace *>((object ? object->qt_metacast(IId) : Q_NULLPTR)); } \ { return reinterpret_cast<IFace *>((object ? object->qt_metacast(IId) : Q_NULLPTR)); } \
template <> inline IFace *qobject_cast<IFace *>(const QObject *object) \ template <> inline IFace *qobject_cast<IFace *>(const QObject *object) \
{ return reinterpret_cast<IFace *>((object ? const_cast<QObject *>(object)->qt_metacast(IId) : Q_NULLPTR)); } { return reinterpret_cast<IFace *>((object ? const_cast<QObject *>(object)->qt_metacast(IId) : Q_NULLPTR)); } \
QT_END_NAMESPACE
#endif // Q_MOC_RUN #endif // Q_MOC_RUN
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM

View file

@ -56,11 +56,10 @@ struct Q_CORE_EXPORT QFactoryInterface
virtual QStringList keys() const = 0; virtual QStringList keys() const = 0;
}; };
QT_END_NAMESPACE
Q_DECLARE_INTERFACE(QFactoryInterface, "com.trolltech.Qt.QFactoryInterface") Q_DECLARE_INTERFACE(QFactoryInterface, "com.trolltech.Qt.QFactoryInterface")
QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER
#endif // QFACTORYINTERFACE_H #endif // QFACTORYINTERFACE_H

View file

@ -245,9 +245,9 @@ set(GUI_PUBLIC_HEADERS
QStyleOptionGroupBox QStyleOptionGroupBox
QStyleOptionProgressBar QStyleOptionProgressBar
QStyleOptionSizeGrip QStyleOptionSizeGrip
QStyleOptionTab
QStyleOptionTabBarBase QStyleOptionTabBarBase
QStyleOptionTabBarBaseV2 QStyleOptionTabBarBaseV2
QStyleOptionTab
QStyleOptionTabV2 QStyleOptionTabV2
QStyleOptionTabV3 QStyleOptionTabV3
QStyleOptionTabWidgetFrame QStyleOptionTabWidgetFrame

View file

@ -58,10 +58,14 @@ struct Q_GUI_EXPORT QIconEngineFactoryInterface : public QFactoryInterface
}; };
typedef QIconEngineFactoryInterface QIconEngineFactoryInterfaceV2; typedef QIconEngineFactoryInterface QIconEngineFactoryInterfaceV2;
QT_END_NAMESPACE
#define QIconEngineFactoryInterface_iid \ #define QIconEngineFactoryInterface_iid \
"com.trolltech.Qt.QIconEngineFactoryInterface" "com.trolltech.Qt.QIconEngineFactoryInterface"
Q_DECLARE_INTERFACE(QIconEngineFactoryInterface, QIconEngineFactoryInterface_iid) Q_DECLARE_INTERFACE(QIconEngineFactoryInterface, QIconEngineFactoryInterface_iid)
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QIconEnginePlugin : public QObject, public QIconEngineFactoryInterface class Q_GUI_EXPORT QIconEnginePlugin : public QObject, public QIconEngineFactoryInterface
{ {
Q_OBJECT Q_OBJECT

View file

@ -119,9 +119,13 @@ struct Q_GUI_EXPORT QImageIOHandlerFactoryInterface : public QFactoryInterface
virtual QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const = 0; virtual QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const = 0;
}; };
QT_END_NAMESPACE
#define QImageIOHandlerFactoryInterface_iid "com.trolltech.Qt.QImageIOHandlerFactoryInterface" #define QImageIOHandlerFactoryInterface_iid "com.trolltech.Qt.QImageIOHandlerFactoryInterface"
Q_DECLARE_INTERFACE(QImageIOHandlerFactoryInterface, QImageIOHandlerFactoryInterface_iid) Q_DECLARE_INTERFACE(QImageIOHandlerFactoryInterface, QImageIOHandlerFactoryInterface_iid)
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QImageIOPlugin : public QObject, public QImageIOHandlerFactoryInterface class Q_GUI_EXPORT QImageIOPlugin : public QObject, public QImageIOHandlerFactoryInterface
{ {
Q_OBJECT Q_OBJECT

View file

@ -64,15 +64,18 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
struct Q_NETWORK_EXPORT QBearerEngineFactoryInterface : public QFactoryInterface struct Q_NETWORK_EXPORT QBearerEngineFactoryInterface : public QFactoryInterface
{ {
virtual QBearerEngine *create(const QString &key) const = 0; virtual QBearerEngine *create(const QString &key) const = 0;
}; };
QT_END_NAMESPACE
#define QBearerEngineFactoryInterface_iid "com.trolltech.Qt.QBearerEngineFactoryInterface" #define QBearerEngineFactoryInterface_iid "com.trolltech.Qt.QBearerEngineFactoryInterface"
Q_DECLARE_INTERFACE(QBearerEngineFactoryInterface, QBearerEngineFactoryInterface_iid) Q_DECLARE_INTERFACE(QBearerEngineFactoryInterface, QBearerEngineFactoryInterface_iid)
QT_BEGIN_NAMESPACE
class Q_NETWORK_EXPORT QBearerEnginePlugin : public QObject, public QBearerEngineFactoryInterface class Q_NETWORK_EXPORT QBearerEnginePlugin : public QObject, public QBearerEngineFactoryInterface
{ {
Q_OBJECT Q_OBJECT

View file

@ -32,7 +32,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QScriptEngine; class QScriptEngine;
struct Q_SCRIPT_EXPORT QScriptExtensionInterface struct Q_SCRIPT_EXPORT QScriptExtensionInterface
@ -41,11 +40,11 @@ struct Q_SCRIPT_EXPORT QScriptExtensionInterface
virtual void initialize(const QString &key, QScriptEngine *engine) = 0; virtual void initialize(const QString &key, QScriptEngine *engine) = 0;
}; };
QT_END_NAMESPACE
Q_DECLARE_INTERFACE(QScriptExtensionInterface, Q_DECLARE_INTERFACE(QScriptExtensionInterface,
"com.trolltech.Qt.QScriptExtensionInterface/1.0") "com.trolltech.Qt.QScriptExtensionInterface/1.0")
QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER
#endif // QSCRIPTEXTENSIONINTERFACE_H #endif // QSCRIPTEXTENSIONINTERFACE_H

View file

@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QSqlDriver; class QSqlDriver;
struct Q_SQL_EXPORT QSqlDriverFactoryInterface : public QFactoryInterface struct Q_SQL_EXPORT QSqlDriverFactoryInterface : public QFactoryInterface
@ -57,9 +56,13 @@ struct Q_SQL_EXPORT QSqlDriverFactoryInterface : public QFactoryInterface
virtual QSqlDriver *create(const QString &name) = 0; virtual QSqlDriver *create(const QString &name) = 0;
}; };
QT_END_NAMESPACE
#define QSqlDriverFactoryInterface_iid "com.trolltech.Qt.QSqlDriverFactoryInterface" #define QSqlDriverFactoryInterface_iid "com.trolltech.Qt.QSqlDriverFactoryInterface"
Q_DECLARE_INTERFACE(QSqlDriverFactoryInterface, QSqlDriverFactoryInterface_iid) Q_DECLARE_INTERFACE(QSqlDriverFactoryInterface, QSqlDriverFactoryInterface_iid)
QT_BEGIN_NAMESPACE
class Q_SQL_EXPORT QSqlDriverPlugin : public QObject, public QSqlDriverFactoryInterface class Q_SQL_EXPORT QSqlDriverPlugin : public QObject, public QSqlDriverFactoryInterface
{ {
Q_OBJECT Q_OBJECT

View file

@ -80,8 +80,12 @@ public:
virtual QString codeTemplate() const { return QString(); } virtual QString codeTemplate() const { return QString(); }
}; };
QT_END_NAMESPACE
Q_DECLARE_INTERFACE(QDesignerCustomWidgetInterface, "com.trolltech.Qt.Designer.CustomWidget") Q_DECLARE_INTERFACE(QDesignerCustomWidgetInterface, "com.trolltech.Qt.Designer.CustomWidget")
QT_BEGIN_NAMESPACE
class QDesignerCustomWidgetCollectionInterface class QDesignerCustomWidgetCollectionInterface
{ {
@ -90,11 +94,12 @@ public:
virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const = 0; virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const = 0;
}; };
Q_DECLARE_INTERFACE(QDesignerCustomWidgetCollectionInterface,
"com.trolltech.Qt.Designer.CustomWidgetCollection")
QT_END_NAMESPACE QT_END_NAMESPACE
Q_DECLARE_INTERFACE(QDesignerCustomWidgetCollectionInterface,
"com.trolltech.Qt.Designer.CustomWidgetCollection")
QT_END_HEADER QT_END_HEADER
#endif // CUSTOMWIDGET_H #endif // CUSTOMWIDGET_H