I want to use the following Virtual Keyboard library in a Qt QML application.
https://github.com/amarula/cutekeyboard/
The plugin and application builds successfully, but when I start the application I get the following error:
QQmlApplicationEngine failed to load component
qrc:/qt/qml/qml_test/Main.qml:4:1: Module loaded for URI 'QtQuick.CuteKeyboard' does not implement QQmlEngineExtensionInterface
How do I build a project to use the above plugins in Qt 6.8?
I'm a beginner with Qt.
The environment is as follows. OS: Ubuntu 24.04 Qt: 6.8.3 Qt Creator: 17.0.2 Cmake: 3.28.3
I have tried the following
build and install cutekeyboard
~$ git clone https://github.com/amarula/cutekeyboard.git
~/cutekeyboard$ cmake -S . -B build -GNinja
~/cutekeyboard$ cmake --build build --target all
~/cutekeyboard/build$ sudo cmake --install .
-- Install configuration: ""
-- Installing: /usr/lib/x86_64-linux-gnu/cmake/Qt6/../../../plugins/platforminputcontexts/libcutekeyboardplugin.so
-- Set non-toolchain portion of runtime path of "/usr/lib/x86_64-linux-gnu/cmake/Qt6/../../../plugins/platforminputcontexts/libcutekeyboardplugin.so" to "$ORIGIN/../../../lib"
copy the build files to the Qt directory
sudo cp -r cutekeyboard/build/src/QtQuick/CuteKeyboard /opt/Qt/6.8.3/gcc_64/qml/QtQuick
create qml project
Create a QML Application Project in Qt Creator.
Add the following to the source.
main.cpp
qputenv("QT_IM_MODULE", QByteArray("cutekeyboard"));
Main.qml
import QtQuick.CuteKeyboard 1.0
Errors while reading typeinfo files: File "/opt/Qt/6.8.3/gcc_64/qml/QtQuick/CuteKeyboard/cutekeyboardplugin.qmltypes" does not exist.
When I run the application, the following error occurs:
16:29:58: Starting /home/.../qml_test/build/Desktop_Qt_6_8_3-Debug/appqml_test...
QML debugging is enabled. Only use this in a safe environment.
QQmlApplicationEngine failed to load component
qrc:/qt/qml/qml_test/Main.qml:4:1: Module loaded for URI 'QtQuick.CuteKeyboard' does not implement QQmlEngineExtensionInterface
16:29:58: The command "/home/.../qml_test/build/Desktop_Qt_6_8_3-Debug/appqml_test" terminated with exit code 255.
Update #1
When I run the cmake command with BUILD_EXAMPLES turned ON to build the cutekeyboard example, the following error occurs:
~/cutekeyboard$ cmake -S . -B build -GNinja -DBUILD_EXAMPLES=ON
...
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreMacros.cmake:2428 (message):
Unexpected arguments: OUTPUT_SCRIPT;deploy_script
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreMacros.cmake:2503 (qt6_generate_deploy_app_script)
example/CMakeLists.txt:15 (qt_generate_deploy_app_script)
Update #2
After specifying the options as follows, the example project also built successfully.
cmake -S . -B build -GNinja -DBUILD_EXAMPLES=ON -DCMAKE_PREFIX_PATH=/opt/Qt/6.5.3/gcc_64 -DQT_DIR=/opt/Qt/6.5.3/gcc_64/lib/cmake/Qt6
The example project built successfully, but when launched, the following is output to the terminal and the GUI does not appear.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
QQmlApplicationEngine failed to load component
qrc:/main.qml:5:1: module "QtQuick.Window" is not installed
qrc:/main.qml:4:1: module "QtQuick.Layouts" is not installed
qrc:/main.qml:3:1: module "QtQuick.CuteKeyboard" is not installed
qrc:/main.qml:2:1: module "QtQuick.Controls" is not installed
When I launched my own project, the following error occurred.
QQmlApplicationEngine failed to load component
qrc:/qt/qml/ck_test_65/Main.qml:3:1: Namespace 'QtQuick.CuteKeyboard' has already been used for type registration
Update #1to original post.