diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-04-22 01:00:07 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-04-23 09:53:31 +0200 |
commit | 0cf8e2fb974370fd6d370f92fa22fa2245bcebb0 (patch) | |
tree | f7b471bd8abb111e32a220bca24bd508b7871cca /src/qml/qml/qqml.h | |
parent | c00283bb3bb966bf60c307ec8283bd98c12318bf (diff) | |
parent | 53bd6b8111eb0d7f23b3b0ca95bef4735f7a952c (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
src/qml/qml/qqmlmetatype.cpp
Change-Id: Ieff61c076e46eb50a059c8b0210f7f4d7ce0cbcf
Diffstat (limited to 'src/qml/qml/qqml.h')
-rw-r--r-- | src/qml/qml/qqml.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h index 3000f56601..82dc8d0c1b 100644 --- a/src/qml/qml/qqml.h +++ b/src/qml/qml/qqml.h @@ -582,6 +582,10 @@ namespace QtQml { Q_QML_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true); Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *, const QObject *, const QMetaObject *, bool create); + Q_QML_EXPORT QQmlAttachedPropertiesFunc qmlAttachedPropertiesFunction(QObject *, + const QMetaObject *); + Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(QObject *, QQmlAttachedPropertiesFunc func, + bool create = true); #ifndef Q_QDOC } @@ -602,8 +606,9 @@ Q_QML_EXPORT void qmlRegisterModule(const char *uri, int versionMajor, int versi template<typename T> QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true) { - static int idx = -1; - return qmlAttachedPropertiesObject(&idx, obj, &T::staticMetaObject, create); + QObject *mutableObj = const_cast<QObject *>(obj); + return qmlAttachedPropertiesObject( + mutableObj, qmlAttachedPropertiesFunction(mutableObj, &T::staticMetaObject), create); } inline int qmlRegisterSingletonType(const char *uri, int versionMajor, int versionMinor, const char *typeName, |