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.6k 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.
  • S small_bird
    2 Aug 2018, 02:06

    Hello, how to custom Qt Quick Virtual Keyboard, that is how to add one button to the qml virtual keyboard?

    R Offline
    R Offline
    raven-worx
    Moderators
    wrote on 2 Aug 2018, 10:38 last edited by raven-worx 8 Sept 2018, 06:54
    #2

    @small_bird
    https://doc.qt.io/qt-5.11/technical-guide.html#adding-custom-layouts

    1. copy the existing layout files from QTDIR/qtvirtualkeyboard/src/virtualkeyboard/content/layouts/en_GB
    2. adapt to your needs
    3. add the files in a (custom) path (e.g. :/path/to/my/kb/layouts/en_GB) to your qrc
    4. in the beginning of your main() add:
    qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
    qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", ":/path/to/my/kb/layouts");
    

    --- 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 3 Aug 2018, 00:52
    3
    • R raven-worx
      2 Aug 2018, 10:38

      @small_bird
      https://doc.qt.io/qt-5.11/technical-guide.html#adding-custom-layouts

      1. copy the existing layout files from QTDIR/qtvirtualkeyboard/src/virtualkeyboard/content/layouts/en_GB
      2. adapt to your needs
      3. add the files in a (custom) path (e.g. :/path/to/my/kb/layouts/en_GB) to your qrc
      4. in the beginning of your main() add:
      qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
      qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", ":/path/to/my/kb/layouts");
      
      S Offline
      S Offline
      small_bird
      wrote on 3 Aug 2018, 00:52 last edited by
      #3

      @raven-worx Yes,I have done like that, however, it shows black rect.

      R 1 Reply Last reply 3 Aug 2018, 06:37
      0
      • S small_bird
        3 Aug 2018, 00:52

        @raven-worx Yes,I have done like that, however, it shows black rect.

        R Offline
        R Offline
        raven-worx
        Moderators
        wrote on 3 Aug 2018, 06:37 last edited by
        #4

        @small_bird
        it shows a black rect where?
        Where the button should be or where the keyboard should be?

        Anyway show some code/qrc in order to give proper help.

        --- 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 3 Aug 2018, 07:36
        1
        • R raven-worx
          3 Aug 2018, 06:37

          @small_bird
          it shows a black rect where?
          Where the button should be or where the keyboard should be?

          Anyway show some code/qrc in order to give proper help.

          S Offline
          S Offline
          small_bird
          wrote on 3 Aug 2018, 07:36 last edited by
          #5

          @raven-worx 0_1533281756248_captured.PNG

          S 1 Reply Last reply 3 Aug 2018, 07:36
          0
          • S small_bird
            3 Aug 2018, 07:36

            @raven-worx 0_1533281756248_captured.PNG

            S Offline
            S Offline
            small_bird
            wrote on 3 Aug 2018, 07:36 last edited by small_bird 8 Mar 2018, 08:40
            #6

            @small_bird 0_1533285635135_shortCut.png

            R 1 Reply Last reply 3 Aug 2018, 10:42
            0
            • S small_bird
              3 Aug 2018, 07:36

              @small_bird 0_1533285635135_shortCut.png

              R Offline
              R Offline
              raven-worx
              Moderators
              wrote on 3 Aug 2018, 10:42 last edited by
              #7

              @small_bird
              any console output?
              what is the content of QT_VIRTUALKEYBOARD_LAYOUT_PATH?
              Did you add an InputPanel element to your application?
              ...

              --- 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 6 Aug 2018, 01:07
              0
              • R raven-worx
                3 Aug 2018, 10:42

                @small_bird
                any console output?
                what is the content of QT_VIRTUALKEYBOARD_LAYOUT_PATH?
                Did you add an InputPanel element to your application?
                ...

                S Offline
                S Offline
                small_bird
                wrote on 6 Aug 2018, 01:07 last edited by
                #8

                @raven-worx
                The QT_VIRTUALKEYBOARD_LAYOUT_PATH is QByteArray(":/layouts/en_GB").
                No InputPanel.

                R 1 Reply Last reply 6 Aug 2018, 06:32
                0
                • S small_bird
                  6 Aug 2018, 01:07

                  @raven-worx
                  The QT_VIRTUALKEYBOARD_LAYOUT_PATH is QByteArray(":/layouts/en_GB").
                  No InputPanel.

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

                  @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

                  --- 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 3 Replies Last reply 6 Aug 2018, 07:59
                  2
                  • R raven-worx
                    6 Aug 2018, 06:32

                    @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

                    S Offline
                    S Offline
                    small_bird
                    wrote on 6 Aug 2018, 07:59 last edited by
                    #10

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

                    P 1 Reply Last reply 20 May 2022, 13:53
                    0
                    • R raven-worx
                      6 Aug 2018, 06:32

                      @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

                      S Offline
                      S Offline
                      small_bird
                      wrote on 6 Aug 2018, 08:09 last edited by
                      #11
                      This post is deleted!
                      1 Reply Last reply
                      0
                      • R raven-worx
                        6 Aug 2018, 06:32

                        @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

                        S Offline
                        S Offline
                        small_bird
                        wrote on 8 Aug 2018, 06:09 last edited by small_bird 8 Aug 2018, 06:12
                        #12

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

                        R 1 Reply Last reply 8 Aug 2018, 06:34
                        0
                        • S small_bird
                          8 Aug 2018, 06:09

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

                          R Offline
                          R Offline
                          raven-worx
                          Moderators
                          wrote on 8 Aug 2018, 06:34 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

                          S 1 Reply Last reply 8 Aug 2018, 06:58
                          0
                          • R raven-worx
                            8 Aug 2018, 06:34

                            @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

                            S Offline
                            S Offline
                            small_bird
                            wrote on 8 Aug 2018, 06:58 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

                            R 1 Reply Last reply 8 Aug 2018, 07:17
                            0
                            • S small_bird
                              8 Aug 2018, 06:58

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

                              R Offline
                              R Offline
                              raven-worx
                              Moderators
                              wrote on 8 Aug 2018, 07:17 last edited by raven-worx 8 Sept 2018, 06:56
                              #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

                              S 1 Reply Last reply 8 Aug 2018, 07:27
                              0
                              • R raven-worx
                                8 Aug 2018, 07:17

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

                                S Offline
                                S Offline
                                small_bird
                                wrote on 8 Aug 2018, 07:27 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?

                                R 1 Reply Last reply 8 Aug 2018, 07:38
                                0
                                • S small_bird
                                  8 Aug 2018, 07:27

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

                                  R Offline
                                  R Offline
                                  raven-worx
                                  Moderators
                                  wrote on 8 Aug 2018, 07:38 last edited by raven-worx 8 Sept 2018, 06:46
                                  #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

                                  S 1 Reply Last reply 8 Aug 2018, 07:41
                                  0
                                  • R raven-worx
                                    8 Aug 2018, 07:38

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

                                    S Offline
                                    S Offline
                                    small_bird
                                    wrote on 8 Aug 2018, 07:41 last edited by
                                    #18

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

                                    R 1 Reply Last reply 8 Aug 2018, 07:43
                                    0
                                    • S small_bird
                                      8 Aug 2018, 07:41

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

                                      R Offline
                                      R Offline
                                      raven-worx
                                      Moderators
                                      wrote on 8 Aug 2018, 07:43 last edited by raven-worx 8 Aug 2018, 07:44
                                      #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

                                      S 1 Reply Last reply 8 Aug 2018, 07:50
                                      0
                                      • R raven-worx
                                        8 Aug 2018, 07:43

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

                                        S Offline
                                        S Offline
                                        small_bird
                                        wrote on 8 Aug 2018, 07:50 last edited by
                                        #20

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

                                        R 1 Reply Last reply 8 Aug 2018, 07:56
                                        0
                                        • S small_bird
                                          8 Aug 2018, 07:50

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

                                          R Offline
                                          R Offline
                                          raven-worx
                                          Moderators
                                          wrote on 8 Aug 2018, 07:56 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

                                          S 2 Replies Last reply 8 Aug 2018, 08:12
                                          0

                                          11/37

                                          6 Aug 2018, 08:09

                                          topic:navigator.unread, 26
                                          • Login

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