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 qml virtual keyboard ?
Forum Updated to NodeBB v4.3 + New Features

How to custom qml virtual keyboard ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
37 Posts 7 Posters 22.0k Views 4 Watching
  • 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.
  • R raven-worx
    8 Aug 2018, 07:56

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

    S Offline
    S Offline
    small_bird
    wrote on 8 Aug 2018, 08:31 last edited by
    #23

    @raven-worx The output is "Can not find style "style" - fallback: "default"

    R 1 Reply Last reply 8 Aug 2018, 10:06
    0
    • S small_bird
      8 Aug 2018, 08:31

      @raven-worx The output is "Can not find style "style" - fallback: "default"

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 8 Aug 2018, 10:06 last edited by
      #24

      @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 your style.qml into the following qrc path (where STYLENAME is the name you provide in the QT_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.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      S 1 Reply Last reply 8 Aug 2018, 23:59
      0
      • R raven-worx
        8 Aug 2018, 10:06

        @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 your style.qml into the following qrc path (where STYLENAME is the name you provide in the QT_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.

        S Offline
        S Offline
        small_bird
        wrote on 8 Aug 2018, 23:59 last edited by
        #25

        @raven-worx 0_1533772777685_捕获.PNG

        R 1 Reply Last reply 9 Aug 2018, 06:39
        0
        • S small_bird
          8 Aug 2018, 23:59

          @raven-worx 0_1533772777685_捕获.PNG

          R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 9 Aug 2018, 06:39 last edited by
          #26

          @small_bird
          last time...
          engine->addImportPath(":/kbstyles")

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          S 1 Reply Last reply 9 Aug 2018, 06:41
          1
          • R raven-worx
            9 Aug 2018, 06:39

            @small_bird
            last time...
            engine->addImportPath(":/kbstyles")

            S Offline
            S Offline
            small_bird
            wrote on 9 Aug 2018, 06:41 last edited by
            #27

            @raven-worx Does not work, thanks all the same!

            R 1 Reply Last reply 9 Aug 2018, 06:51
            0
            • S small_bird
              9 Aug 2018, 06:41

              @raven-worx Does not work, thanks all the same!

              R Offline
              R Offline
              raven-worx
              Moderators
              wrote on 9 Aug 2018, 06:51 last edited by
              #28

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

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              S 1 Reply Last reply 14 Aug 2018, 02:58
              0
              • R raven-worx
                9 Aug 2018, 06:51

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

                S Offline
                S Offline
                small_bird
                wrote on 14 Aug 2018, 02:58 last edited by
                #29

                @raven-worx 0_1534215503237_捕获.PNG
                Warning:。。。。。。

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  GSElabs
                  wrote on 14 May 2019, 10:09 last edited by
                  #30

                  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"));
                  
                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    Vincent_Law
                    wrote on 4 Apr 2022, 14:26 last edited by
                    #31

                    Thank u for this thread. I resolved my problem with ru_RU <3

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      priyankar
                      wrote on 20 May 2022, 09:42 last edited by
                      #32

                      how to check the path set for QT_VIRTUALKEYBOARD_LAYOUT_PATH ?

                      L 1 Reply Last reply 20 May 2022, 10:14
                      0
                      • P priyankar
                        20 May 2022, 09:42

                        how to check the path set for QT_VIRTUALKEYBOARD_LAYOUT_PATH ?

                        L Offline
                        L Offline
                        lemons
                        wrote on 20 May 2022, 10:14 last edited by
                        #33

                        @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

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          priyankar
                          wrote on 20 May 2022, 11:58 last edited by
                          #34

                          Thanks.
                          Tried but still the keyboard is blank

                          1 Reply Last reply
                          0
                          • S small_bird
                            6 Aug 2018, 07:59

                            @raven-worx Thanks a lot! I have made it!

                            P Offline
                            P Offline
                            priyankar
                            wrote on 20 May 2022, 13:53 last edited by
                            #35

                            @small_bird can you share how you resolved I'm facing same issue

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              dmendez
                              wrote on 23 Jun 2022, 03:37 last edited by
                              #36

                              The correct path for styles is actually not just QtQuick/VirtualKeyboard/Styles.
                              In the documentation it states it is: $$[QT_INSTALL_QML]/QtQuick/VirtualKeyboard/Styles.
                              If the path to QtQuick/VirtualKeyboard/Styles is qrc:/kbstyles as above then to include the [QT_INSTALL_QML] portion for QML >= 2.0.0 put in main.cpp:
                              qputenv("QML2_IMPORT_PATH", "qrc:/kbstyles")

                              The code should look similar to this:

                              QQmlApplicationEngine engine;
                              qputenv("QML2_IMPORT_PATH", "qrc:/kbstyles");

                              engine.addImportPath("qrc:/kbstyles");
                              qputenv("QT_VIRTUALKEYBOARD_STYLE", "keyboardStyle");

                              qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH",
                              "qrc:/kbstyles/QtQuick/VirtualKeyboard/layouts");

                              engine.load(QUrl("qrc:/main.qml"));

                              P 1 Reply Last reply 27 Jun 2022, 10:04
                              1
                              • D dmendez
                                23 Jun 2022, 03:37

                                The correct path for styles is actually not just QtQuick/VirtualKeyboard/Styles.
                                In the documentation it states it is: $$[QT_INSTALL_QML]/QtQuick/VirtualKeyboard/Styles.
                                If the path to QtQuick/VirtualKeyboard/Styles is qrc:/kbstyles as above then to include the [QT_INSTALL_QML] portion for QML >= 2.0.0 put in main.cpp:
                                qputenv("QML2_IMPORT_PATH", "qrc:/kbstyles")

                                The code should look similar to this:

                                QQmlApplicationEngine engine;
                                qputenv("QML2_IMPORT_PATH", "qrc:/kbstyles");

                                engine.addImportPath("qrc:/kbstyles");
                                qputenv("QT_VIRTUALKEYBOARD_STYLE", "keyboardStyle");

                                qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH",
                                "qrc:/kbstyles/QtQuick/VirtualKeyboard/layouts");

                                engine.load(QUrl("qrc:/main.qml"));

                                P Offline
                                P Offline
                                priyankar
                                wrote on 27 Jun 2022, 10:04 last edited by
                                #37

                                @dmendez thanks, it worked!

                                1 Reply Last reply
                                0
                                • Ronel_qtmasterR Ronel_qtmaster referenced this topic on 16 Mar 2024, 09:43

                                • Login

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