How to custom qml virtual keyboard ?
-
- set the
QT_VIRTUALKEYBOARD_STYLE
to_STYLENAME_
- put the style.qml into your existing qrc (e.g. to the path
:/kbstyles/test.qml
:/kbstyles/QtQuick/VirtualKeyboard/Styles/_STYLENAME_/style.qml
) - add the import path to your QQmlEngine (
engine->addImportPath(":/kbstyles")
)
did you copy the existing (default) virtual keyboard style and made your changes upon it?
wrote on 8 Aug 2018, 07:27 last edited by@raven-worx Yes, I have done that. "set the QT_VIRTUALKEYBOARD_STYLE to test"? What is the meaning? to test.qml file?
- set the
-
@raven-worx Yes, I have done that. "set the QT_VIRTUALKEYBOARD_STYLE to test"? What is the meaning? to test.qml file?
Moderatorswrote on 8 Aug 2018, 07:38 last edited by raven-worx 8 Sept 2018, 06:46@small_bird
the name of theqml filefolder containing style.qml -
@small_bird
the name of theqml filefolder containing style.qmlwrote on 8 Aug 2018, 07:41 last edited by@raven-worx
Is this all right? -
@raven-worx
Is this all right?Moderatorswrote on 8 Aug 2018, 07:43 last edited by raven-worx 8 Aug 2018, 07:44@small_bird
you said you read the link didnt you?!
you should set it as a env variable!
qputenv("QT_VIRTUALKEYBOARD_STYLE", "test");
-
@small_bird
you said you read the link didnt you?!
you should set it as a env variable!
qputenv("QT_VIRTUALKEYBOARD_STYLE", "test");
wrote on 8 Aug 2018, 07:50 last edited by@raven-worx
Another problem happens! -
@raven-worx
Another problem happens!@small_bird
read my post (regarding the style setup) again line by line and compare it to your code.
Why do you add the layout path to the engine's import path?!The keyboard styles and layout are different concepts, so don't mix them up.
-
@small_bird
read my post (regarding the style setup) again line by line and compare it to your code.
Why do you add the layout path to the engine's import path?!The keyboard styles and layout are different concepts, so don't mix them up.
wrote on 8 Aug 2018, 08:12 last edited by small_bird 8 Aug 2018, 08:15@raven-worx
The out put is the same! -
@small_bird
read my post (regarding the style setup) again line by line and compare it to your code.
Why do you add the layout path to the engine's import path?!The keyboard styles and layout are different concepts, so don't mix them up.
wrote on 8 Aug 2018, 08:31 last edited by@raven-worx The output is "Can not find style "style" - fallback: "default"
-
@raven-worx The output is "Can not find style "style" - fallback: "default"
@small_bird
my "fault". but anyway again this is described in the link i've posted.In the given import path Qt expects the style to be in the path
/QtQuick/VirtualKeyboard/Styles
So add yourstyle.qml
into the following qrc path (where STYLENAME is the name you provide in theQT_VIRTUALKEYBOARD_STYLE
env variable):
:/kbstyles/QtQuick/VirtualKeyboard/Styles/STYLENAME
=> so it becomes:/kbstyles/QtQuick/VirtualKeyboard/Styles/STYLENAME/style.qml
So
QT_VIRTUALKEYBOARD_STYLE
determines the folder name (which contains a style.qml) not the name of the qml file itself. -
@small_bird
my "fault". but anyway again this is described in the link i've posted.In the given import path Qt expects the style to be in the path
/QtQuick/VirtualKeyboard/Styles
So add yourstyle.qml
into the following qrc path (where STYLENAME is the name you provide in theQT_VIRTUALKEYBOARD_STYLE
env variable):
:/kbstyles/QtQuick/VirtualKeyboard/Styles/STYLENAME
=> so it becomes:/kbstyles/QtQuick/VirtualKeyboard/Styles/STYLENAME/style.qml
So
QT_VIRTUALKEYBOARD_STYLE
determines the folder name (which contains a style.qml) not the name of the qml file itself.wrote on 8 Aug 2018, 23:59 last edited by -
@small_bird
last time...
engine->addImportPath(":/kbstyles")
-
@small_bird
last time...
engine->addImportPath(":/kbstyles")
wrote on 9 Aug 2018, 06:41 last edited by@raven-worx Does not work, thanks all the same!
-
@raven-worx Does not work, thanks all the same!
@small_bird
if you follow the instructions in my post it definitely works, i used it myself already.
If not you are still doing something wrong.
Only advice left i can give is try a full rebuild (clean, rerun qmake, build again) -
@small_bird
if you follow the instructions in my post it definitely works, i used it myself already.
If not you are still doing something wrong.
Only advice left i can give is try a full rebuild (clean, rerun qmake, build again)wrote on 14 Aug 2018, 02:58 last edited by@raven-worx
Warning:。。。。。。 -
wrote on 14 May 2019, 10:09 last edited by
The problem may be in the order of the addImportPath and engine.load actions. I found that
engine.load(QUrl("qrc:/main.qml"));
must be executed only after
engine.addImportPath("qrc:/kbstyles"); qputenv("QT_VIRTUALKEYBOARD_STYLE", "mykbstl");
So the code must be something like this:
QQmlApplicationEngine engine; engine.addImportPath("qrc:/kbstyles"); qputenv("QT_VIRTUALKEYBOARD_STYLE", "mykbstl"); engine.load(QUrl("qrc:/main.qml"));
-
wrote on 4 Apr 2022, 14:26 last edited by
Thank u for this thread. I resolved my problem with ru_RU <3
-
wrote on 20 May 2022, 09:42 last edited by
how to check the path set for QT_VIRTUALKEYBOARD_LAYOUT_PATH ?
-
wrote on 20 May 2022, 10:14 last edited by
@priyankar maybe my answer in this topic helps you:
https://forum.qt.io/topic/134990/customising-qt-virtual-keyboard-qml-for-a-cross-compiled-remote-device/3 -
wrote on 20 May 2022, 11:58 last edited by
Thanks.
Tried but still the keyboard is blank -
@raven-worx Thanks a lot! I have made it!
wrote on 20 May 2022, 13:53 last edited by@small_bird can you share how you resolved I'm facing same issue