diff --git a/src/plugins/qmldesigner/components/componentcore/theme.cpp b/src/plugins/qmldesigner/components/componentcore/theme.cpp index af495fd3b56..ef618447e71 100644 --- a/src/plugins/qmldesigner/components/componentcore/theme.cpp +++ b/src/plugins/qmldesigner/components/componentcore/theme.cpp @@ -10,6 +10,7 @@ #include +#include #include #include #include @@ -18,7 +19,7 @@ #include #include #include -#include +#include static Q_LOGGING_CATEGORY(themeLog, "qtc.qmldesigner.theme", QtWarningMsg) @@ -140,7 +141,9 @@ bool Theme::highPixelDensity() 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)