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;
};
#define QTextCodecFactoryInterface_iid "com.trolltech.Qt.QTextCodecFactoryInterface"
QT_END_NAMESPACE
#define QTextCodecFactoryInterface_iid "com.trolltech.Qt.QTextCodecFactoryInterface"
Q_DECLARE_INTERFACE(QTextCodecFactoryInterface, QTextCodecFactoryInterface_iid)
QT_BEGIN_NAMESPACE
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
# define Q_DECLARE_INTERFACE(IFace, IId) \
QT_BEGIN_NAMESPACE \
template <> inline const char *qobject_interface_iid<IFace *>() \
{ return IId; } \
template <> inline IFace *qobject_cast<IFace *>(QObject *object) \
{ return reinterpret_cast<IFace *>((object ? object->qt_metacast(IId) : Q_NULLPTR)); } \
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
#ifndef QT_NO_DEBUG_STREAM

View file

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

View file

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

View file

@ -58,10 +58,14 @@ struct Q_GUI_EXPORT QIconEngineFactoryInterface : public QFactoryInterface
};
typedef QIconEngineFactoryInterface QIconEngineFactoryInterfaceV2;
QT_END_NAMESPACE
#define QIconEngineFactoryInterface_iid \
"com.trolltech.Qt.QIconEngineFactoryInterface"
Q_DECLARE_INTERFACE(QIconEngineFactoryInterface, QIconEngineFactoryInterface_iid)
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QIconEnginePlugin : public QObject, public QIconEngineFactoryInterface
{
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;
};
QT_END_NAMESPACE
#define QImageIOHandlerFactoryInterface_iid "com.trolltech.Qt.QImageIOHandlerFactoryInterface"
Q_DECLARE_INTERFACE(QImageIOHandlerFactoryInterface, QImageIOHandlerFactoryInterface_iid)
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QImageIOPlugin : public QObject, public QImageIOHandlerFactoryInterface
{
Q_OBJECT

View file

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

View file

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

View file

@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QSqlDriver;
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;
};
QT_END_NAMESPACE
#define QSqlDriverFactoryInterface_iid "com.trolltech.Qt.QSqlDriverFactoryInterface"
Q_DECLARE_INTERFACE(QSqlDriverFactoryInterface, QSqlDriverFactoryInterface_iid)
QT_BEGIN_NAMESPACE
class Q_SQL_EXPORT QSqlDriverPlugin : public QObject, public QSqlDriverFactoryInterface
{
Q_OBJECT

View file

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