Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to custom style qml virtual keyboard in Qt 6

How to custom style qml virtual keyboard in Qt 6

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
7 Posts 3 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bambooMZL
    wrote on 18 Apr 2023, 07:20 last edited by
    #1

    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.qml

    But, 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.

    L J 2 Replies Last reply 18 Apr 2023, 11:42
    0
    • B bambooMZL
      18 Apr 2023, 07:20

      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.qml

      But, 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.

      L Offline
      L Offline
      lemons
      wrote on 18 Apr 2023, 11:42 last edited by
      #2

      @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/3

      Maybe this helps you...

      B 1 Reply Last reply 19 Apr 2023, 02:07
      1
      • L lemons
        18 Apr 2023, 11:42

        @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/3

        Maybe this helps you...

        B Offline
        B Offline
        bambooMZL
        wrote on 19 Apr 2023, 02:07 last edited by
        #3

        @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/3

        I can change the keyboard layout.
        But the style can't. The error is: WARNING: Cannot find style "MYKD" - fallback: "default"

        Thanks.

        L 1 Reply Last reply 19 Apr 2023, 06:03
        0
        • B bambooMZL
          19 Apr 2023, 02:07

          @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/3

          I can change the keyboard layout.
          But the style can't. The error is: WARNING: Cannot find style "MYKD" - fallback: "default"

          Thanks.

          L Offline
          L Offline
          lemons
          wrote on 19 Apr 2023, 06:03 last edited by
          #4

          @bambooMZL try to change the import path as below:

          # engine.addImportPath((":/MyStyles"));
          engine.addImportPath("qrc:/MyStyles");
          
          B 2 Replies Last reply 19 Apr 2023, 08:03
          0
          • L lemons
            19 Apr 2023, 06:03

            @bambooMZL try to change the import path as below:

            # engine.addImportPath((":/MyStyles"));
            engine.addImportPath("qrc:/MyStyles");
            
            B Offline
            B Offline
            bambooMZL
            wrote on 19 Apr 2023, 08:03 last edited by
            #5

            @lemons Hello, I have tried, The issue is same.

            Thanks very much.

            1 Reply Last reply
            0
            • L lemons
              19 Apr 2023, 06:03

              @bambooMZL try to change the import path as below:

              # engine.addImportPath((":/MyStyles"));
              engine.addImportPath("qrc:/MyStyles");
              
              B Offline
              B Offline
              bambooMZL
              wrote on 20 Apr 2023, 01:13 last edited by
              #6

              @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.

              1 Reply Last reply
              0
              • B bambooMZL
                18 Apr 2023, 07:20

                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.qml

                But, 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.

                J Offline
                J Offline
                john99.chang
                wrote on 20 Sept 2023, 08:58 last edited by john99.chang
                #7

                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.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved