QmlDesigner: Set proper engine ownership

Change-Id: I603cb34209a231226f1ef7ccb269ab8813f2758d
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2024-04-22 17:43:08 +02:00
committed by Tim Jenssen
parent 735d6af931
commit ff4f5133da

View File

@@ -10,6 +10,7 @@
#include <utils/stylehelper.h> #include <utils/stylehelper.h>
#include <qqml.h>
#include <QApplication> #include <QApplication>
#include <QMainWindow> #include <QMainWindow>
#include <QPointer> #include <QPointer>
@@ -18,7 +19,7 @@
#include <QQmlProperty> #include <QQmlProperty>
#include <QRegularExpression> #include <QRegularExpression>
#include <QScreen> #include <QScreen>
#include <qqml.h> #include <QWindow>
static Q_LOGGING_CATEGORY(themeLog, "qtc.qmldesigner.theme", QtWarningMsg) static Q_LOGGING_CATEGORY(themeLog, "qtc.qmldesigner.theme", QtWarningMsg)
@@ -140,7 +141,9 @@ bool Theme::highPixelDensity() const
QWindow *Theme::mainWindowHandle() const QWindow *Theme::mainWindowHandle() const
{ {
return Core::ICore::mainWindow()->windowHandle(); QWindow *handle = Core::ICore::mainWindow()->windowHandle();
QQmlEngine::setObjectOwnership(handle, QJSEngine::CppOwnership);
return handle;
} }
QPixmap Theme::getPixmap(const QString &id) QPixmap Theme::getPixmap(const QString &id)