How to custom style qml virtual keyboard in Qt 6
-
My QT version is 6.4.1.
Now, I am setting the custom style for virtual keyboard.But it can't work.
The code
QQmlApplicationEngine engine;
engine.addImportPath((":/MyStyles"));
qputenv("QT_VIRTUALKEYBOARD_STYLE", ("MYKD"));
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));add the resource file in qrc file.
:/MyStyles/QtQuick/VirtualKeyboard/Styles/MYKD/style.qmlBut, I get the error:
WARNING: Cannot find style "MYKD" - fallback: "default"And I have test the qml file by. (QFileInfo::exists(QString(":/MyStyles/QtQuick/VirtualKeyboard/Styles/MYKD/style.qml")))
The file style.qml is exist.
Why I get the error? Is there any mistake in my code?
Thanks very much for help.
-
My QT version is 6.4.1.
Now, I am setting the custom style for virtual keyboard.But it can't work.
The code
QQmlApplicationEngine engine;
engine.addImportPath((":/MyStyles"));
qputenv("QT_VIRTUALKEYBOARD_STYLE", ("MYKD"));
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));add the resource file in qrc file.
:/MyStyles/QtQuick/VirtualKeyboard/Styles/MYKD/style.qmlBut, I get the error:
WARNING: Cannot find style "MYKD" - fallback: "default"And I have test the qml file by. (QFileInfo::exists(QString(":/MyStyles/QtQuick/VirtualKeyboard/Styles/MYKD/style.qml")))
The file style.qml is exist.
Why I get the error? Is there any mistake in my code?
Thanks very much for help.
@bambooMZL not sure if something was changed with Qt 6.x, but here I described how I did it in a previous project:
https://forum.qt.io/topic/134990/customising-qt-virtual-keyboard-qml-for-a-cross-compiled-remote-device/3Maybe this helps you...
-
@bambooMZL not sure if something was changed with Qt 6.x, but here I described how I did it in a previous project:
https://forum.qt.io/topic/134990/customising-qt-virtual-keyboard-qml-for-a-cross-compiled-remote-device/3Maybe this helps you...
@lemons Hello, Thanks very much for your help.
In Qt Version 6.4.1.
I have tried the method in post, https://forum.qt.io/topic/134990/customising-qt-virtual-keyboard-qml-for-a-cross-compiled-remote-device/3I can change the keyboard layout.
But the style can't. The error is: WARNING: Cannot find style "MYKD" - fallback: "default"Thanks.
-
@lemons Hello, Thanks very much for your help.
In Qt Version 6.4.1.
I have tried the method in post, https://forum.qt.io/topic/134990/customising-qt-virtual-keyboard-qml-for-a-cross-compiled-remote-device/3I can change the keyboard layout.
But the style can't. The error is: WARNING: Cannot find style "MYKD" - fallback: "default"Thanks.
@bambooMZL try to change the import path as below:
# engine.addImportPath((":/MyStyles")); engine.addImportPath("qrc:/MyStyles");
-
@bambooMZL try to change the import path as below:
# engine.addImportPath((":/MyStyles")); engine.addImportPath("qrc:/MyStyles");
-
@bambooMZL try to change the import path as below:
# engine.addImportPath((":/MyStyles")); engine.addImportPath("qrc:/MyStyles");
@lemons
Hello.
I want to get the context of QML virtual keyboard, in main() function.
How can I get it?For example, I can get the root context, by "engine.rootContext();"
But, how can I get the context of keyboard, "qtvirtualkeyboard"Thanks very much.
-
My QT version is 6.4.1.
Now, I am setting the custom style for virtual keyboard.But it can't work.
The code
QQmlApplicationEngine engine;
engine.addImportPath((":/MyStyles"));
qputenv("QT_VIRTUALKEYBOARD_STYLE", ("MYKD"));
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));add the resource file in qrc file.
:/MyStyles/QtQuick/VirtualKeyboard/Styles/MYKD/style.qmlBut, I get the error:
WARNING: Cannot find style "MYKD" - fallback: "default"And I have test the qml file by. (QFileInfo::exists(QString(":/MyStyles/QtQuick/VirtualKeyboard/Styles/MYKD/style.qml")))
The file style.qml is exist.
Why I get the error? Is there any mistake in my code?
Thanks very much for help.
I encountered the same problem at QT 6.4.3. And i found it is a bug in Qt 6.4. There are two workarounds to fix it if you don't want to upgrade QT version.
Please refer to https://bugreports.qt.io/browse/QTBUG-108536 for more details.