Q_DECLARE_INTERFACE: delete unspecialized qobject_interface_iid()
Instead of making it return a non-useful nullptr. Change-Id: Ie72b0dd0fbe84d2caae0fffd16a245cce5ea65f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
da2fd6a903
commit
7e8c7b3ed8
@ -481,8 +481,7 @@ inline T qobject_cast(const QObject *object)
|
||||
}
|
||||
|
||||
|
||||
template <class T> inline const char * qobject_interface_iid()
|
||||
{ return nullptr; }
|
||||
template <class T> constexpr const char * qobject_interface_iid() = delete;
|
||||
|
||||
inline const QBindingStorage *qGetBindingStorage(const QObject *o)
|
||||
{
|
||||
@ -497,7 +496,7 @@ inline QBindingStorage *qGetBindingStorage(QObject *o)
|
||||
# define Q_DECLARE_INTERFACE(IFace, IId)
|
||||
#elif !defined(Q_MOC_RUN)
|
||||
# define Q_DECLARE_INTERFACE(IFace, IId) \
|
||||
template <> inline const char *qobject_interface_iid<IFace *>() \
|
||||
template <> constexpr 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) : nullptr)); } \
|
||||
|
@ -3582,8 +3582,6 @@ void tst_QObject::interfaceIid()
|
||||
QByteArray(Bleh_iid));
|
||||
QCOMPARE(QByteArray(qobject_interface_iid<Foo::Bar *>()),
|
||||
QByteArray("com.qtest.foobar"));
|
||||
QCOMPARE(QByteArray(qobject_interface_iid<FooObject *>()),
|
||||
QByteArray());
|
||||
}
|
||||
|
||||
void tst_QObject::deleteQObjectWhenDeletingEvent()
|
||||
|
Loading…
Reference in New Issue
Block a user