diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-10-31 16:14:13 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-11-02 10:10:02 +0000 |
commit | f3d04fdcde181a047d2a6c753e0304d026f0ca9b (patch) | |
tree | d4eeff59d694cdd53bebbb4d5b27b0d59a52d7b3 | |
parent | 43217be9bcc786bff6d0ed23e70a4077e069c29f (diff) |
qqmlprivate.h: Fix BC issue
The old function might still be callde from code compiled against Qt <
6.6. Fix this by providing the old overload in removde_api: It is
implemented by calling the new overload, and then converting the result
to an int. Amends f10630aa035ae1ef4ad75be1107ab77fea0c7e29.
Change-Id: I373460af2a66c069bfc0b57a9bb169d705d2a6b9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 34c4f8aa9ff90d6f614d0726ebf667ba0f435274)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/qml/compat/removed_api.cpp | 16 | ||||
-rw-r--r-- | src/qml/qml/qqmlprivate.h | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/qml/compat/removed_api.cpp b/src/qml/compat/removed_api.cpp index 00c899d73c..fe16b7f462 100644 --- a/src/qml/compat/removed_api.cpp +++ b/src/qml/compat/removed_api.cpp @@ -24,3 +24,19 @@ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr) #endif +#if QT_QML_REMOVED_SINCE(6, 6) +#include <QtQml/qqmlprivate.h> +#include <QtQml/private/qv4executablecompilationunit_p.h> +#include <QtQml/private/qv4lookup_p.h> + +bool QQmlPrivate::AOTCompiledContext::getEnumLookup(uint index, int *target) const +{ + using namespace QQmlPrivate; + QV4::Lookup *l = compilationUnit->runtimeLookups + index; + auto mt = QMetaType(l->qmlEnumValueLookup.metaType); + QVariant buffer(mt); + getEnumLookup(index, buffer.data()); + *target = buffer.toInt(); + return true; +} +#endif diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h index fbb36ba606..23cfaef2e2 100644 --- a/src/qml/qml/qqmlprivate.h +++ b/src/qml/qml/qqmlprivate.h @@ -704,6 +704,9 @@ namespace QQmlPrivate void initGetValueLookup(uint index, const QMetaObject *metaObject, QMetaType type) const; bool getEnumLookup(uint index, void *target) const; +#if QT_QML_REMOVED_SINCE(6, 6) + bool getEnumLookup(uint index, int *target) const; +#endif void initGetEnumLookup(uint index, const QMetaObject *metaObject, const char *enumerator, const char *enumValue) const; |