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 19.7k 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.
  • raven-worxR raven-worx

    @small_bird said in How to custom qml virtual keyboard ?:

    The QT_VIRTUALKEYBOARD_LAYOUT_PATH is QByteArray(":/layouts/en_GB").

    as i stated it should be :/layouts only

    small_birdS Offline
    small_birdS Offline
    small_bird
    wrote on last edited by small_bird
    #12

    @raven-worx How to change the background color of the keyboard, for example, from black to transparent.

    raven-worxR 1 Reply Last reply
    0
    • small_birdS small_bird

      @raven-worx How to change the background color of the keyboard, for example, from black to transparent.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #13

      @small_bird said in How to custom qml virtual keyboard ?:

      How to change the background color of the keyboard, for example, from black to transparent.

      did you read the link from my first post at all?
      https://doc.qt.io/qt-5.11/technical-guide.html#keyboard-styles

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

      small_birdS 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @small_bird said in How to custom qml virtual keyboard ?:

        How to change the background color of the keyboard, for example, from black to transparent.

        did you read the link from my first post at all?
        https://doc.qt.io/qt-5.11/technical-guide.html#keyboard-styles

        small_birdS Offline
        small_birdS Offline
        small_bird
        wrote on last edited by
        #14

        @raven-worx Yes, I have read that, however, it does not work, this is my shortcut of path:
        0_1533711489065_捕获.PNG

        raven-worxR 1 Reply Last reply
        0
        • small_birdS small_bird

          @raven-worx Yes, I have read that, however, it does not work, this is my shortcut of path:
          0_1533711489065_捕获.PNG

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #15

          @small_bird

          1. set the QT_VIRTUALKEYBOARD_STYLE to _STYLENAME_
          2. put the style.qml into your existing qrc (e.g. to the path :/kbstyles/test.qml :/kbstyles/QtQuick/VirtualKeyboard/Styles/_STYLENAME_/style.qml)
          3. 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?

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

          small_birdS 1 Reply Last reply
          0
          • raven-worxR raven-worx

            @small_bird

            1. set the QT_VIRTUALKEYBOARD_STYLE to _STYLENAME_
            2. put the style.qml into your existing qrc (e.g. to the path :/kbstyles/test.qml :/kbstyles/QtQuick/VirtualKeyboard/Styles/_STYLENAME_/style.qml)
            3. 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?

            small_birdS Offline
            small_birdS Offline
            small_bird
            wrote on last edited by
            #16

            @raven-worx Yes, I have done that. "set the QT_VIRTUALKEYBOARD_STYLE to test"? What is the meaning? to test.qml file?

            raven-worxR 1 Reply Last reply
            0
            • small_birdS small_bird

              @raven-worx Yes, I have done that. "set the QT_VIRTUALKEYBOARD_STYLE to test"? What is the meaning? to test.qml file?

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by raven-worx
              #17

              @small_bird
              the name of the qml file folder containing style.qml

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

              small_birdS 1 Reply Last reply
              0
              • raven-worxR raven-worx

                @small_bird
                the name of the qml file folder containing style.qml

                small_birdS Offline
                small_birdS Offline
                small_bird
                wrote on last edited by
                #18

                @raven-worx 0_1533714087446_捕获.PNG
                Is this all right?

                raven-worxR 1 Reply Last reply
                0
                • small_birdS small_bird

                  @raven-worx 0_1533714087446_捕获.PNG
                  Is this all right?

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by raven-worx
                  #19

                  @small_bird
                  you said you read the link didnt you?!
                  you should set it as a env variable!
                  qputenv("QT_VIRTUALKEYBOARD_STYLE", "test");

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

                  small_birdS 1 Reply Last reply
                  0
                  • raven-worxR raven-worx

                    @small_bird
                    you said you read the link didnt you?!
                    you should set it as a env variable!
                    qputenv("QT_VIRTUALKEYBOARD_STYLE", "test");

                    small_birdS Offline
                    small_birdS Offline
                    small_bird
                    wrote on last edited by
                    #20

                    @raven-worx 0_1533714623613_捕获.PNG
                    Another problem happens!

                    raven-worxR 1 Reply Last reply
                    0
                    • small_birdS small_bird

                      @raven-worx 0_1533714623613_捕获.PNG
                      Another problem happens!

                      raven-worxR Offline
                      raven-worxR Offline
                      raven-worx
                      Moderators
                      wrote on last edited by
                      #21

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

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

                      small_birdS 2 Replies Last reply
                      0
                      • raven-worxR raven-worx

                        @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_birdS Offline
                        small_birdS Offline
                        small_bird
                        wrote on last edited by small_bird
                        #22

                        @raven-worx 0_1533716005308_捕获.PNG
                        The out put is the same!

                        1 Reply Last reply
                        0
                        • raven-worxR raven-worx

                          @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_birdS Offline
                          small_birdS Offline
                          small_bird
                          wrote on last edited by
                          #23

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

                          raven-worxR 1 Reply Last reply
                          0
                          • small_birdS small_bird

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

                            raven-worxR Offline
                            raven-worxR Offline
                            raven-worx
                            Moderators
                            wrote on 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

                            small_birdS 1 Reply Last reply
                            0
                            • raven-worxR raven-worx

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

                              small_birdS Offline
                              small_birdS Offline
                              small_bird
                              wrote on last edited by
                              #25

                              @raven-worx 0_1533772777685_捕获.PNG

                              raven-worxR 1 Reply Last reply
                              0
                              • small_birdS small_bird

                                @raven-worx 0_1533772777685_捕获.PNG

                                raven-worxR Offline
                                raven-worxR Offline
                                raven-worx
                                Moderators
                                wrote on 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

                                small_birdS 1 Reply Last reply
                                1
                                • raven-worxR raven-worx

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

                                  small_birdS Offline
                                  small_birdS Offline
                                  small_bird
                                  wrote on last edited by
                                  #27

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

                                  raven-worxR 1 Reply Last reply
                                  0
                                  • small_birdS small_bird

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

                                    raven-worxR Offline
                                    raven-worxR Offline
                                    raven-worx
                                    Moderators
                                    wrote on 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

                                    small_birdS 1 Reply Last reply
                                    0
                                    • raven-worxR raven-worx

                                      @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_birdS Offline
                                      small_birdS Offline
                                      small_bird
                                      wrote on last edited by
                                      #29

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

                                      1 Reply Last reply
                                      0
                                      • G Offline
                                        G Offline
                                        GSElabs
                                        wrote on 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 last edited by
                                          #31

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

                                          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