diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qobjectdefs.h | 5 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index be32921273..24769c28f5 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com> ** Contact: https://www.qt.io/licensing/ ** @@ -358,16 +358,12 @@ bool QMetaObject::inherits(const QMetaObject *metaObject) const noexcept } /*! + \fn QObject *QMetaObject::cast(QObject *obj) const \internal Returns \a obj if object \a obj inherits from this meta-object; otherwise returns \nullptr. */ -QObject *QMetaObject::cast(QObject *obj) const -{ - // ### Qt 6: inline - return const_cast<QObject*>(cast(const_cast<const QObject*>(obj))); -} /*! \internal diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 6c6e4e5a8e..16478d889f 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2019 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -165,7 +165,8 @@ struct Q_CORE_EXPORT QMetaObject const QMetaObject *superClass() const; bool inherits(const QMetaObject *metaObject) const noexcept; - QObject *cast(QObject *obj) const; + QObject *cast(QObject *obj) const + { return const_cast<QObject *>(cast(const_cast<const QObject *>(obj))); } const QObject *cast(const QObject *obj) const; #if !defined(QT_NO_TRANSLATION) || defined(Q_CLANG_QDOC) |