diff --git a/src/VirtualKeyboardInputContext.cpp b/src/VirtualKeyboardInputContext.cpp index c8fe344..84b23c4 100644 --- a/src/VirtualKeyboardInputContext.cpp +++ b/src/VirtualKeyboardInputContext.cpp @@ -10,6 +10,7 @@ #include "EnterKeyAction.hpp" #include "EnterKeyActionAttachedType.hpp" #include "InputPanelIface.hpp" +#include /** * Private data class for VirtualKeyboardInputContext @@ -45,12 +46,11 @@ VirtualKeyboardInputContext::VirtualKeyboardInputContext() "CuteKeyboard", 1, 0, "InputEngine", inputEngineProvider); connect(d->InputEngine, &DeclarativeInputEngine::animatingChanged, this, &VirtualKeyboardInputContext::ensureFocusedObjectVisible); + qmlRegisterSingletonType("CuteKeyboard", 1, 0, "InputPanel", inputPanelProvider); - - qmlRegisterSingletonType( + qmlRegisterSingletonType( "CuteKeyboard", 1, 0, "InputContext", inputContextProvider); - qmlRegisterType("QtQuick.CuteKeyboard", 1, 0, "EnterKeyAction"); qmlRegisterType("CuteKeyboard", 1, 0, "EnterKeyAction"); @@ -217,5 +217,11 @@ QObject *VirtualKeyboardInputContext::inputContextProvider( QQmlEngine *engine, QJSEngine *scriptEngine) { Q_UNUSED(engine) Q_UNUSED(scriptEngine) - return VirtualKeyboardInputContext::instance(); + const auto instance=VirtualKeyboardInputContext::instance(); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QQmlEngine::setObjectOwnership(instance, QQmlEngine::CppOwnership); +#else + QJSEngine::setObjectOwnership(instance,QJSEngine::CppOwnership); +#endif + return instance; }