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. Enabling arrow-key-navigation with QtVirtualKeyboard on Qt 5.15.1
Forum Updated to NodeBB v4.3 + New Features

Enabling arrow-key-navigation with QtVirtualKeyboard on Qt 5.15.1

Scheduled Pinned Locked Moved Solved QML and Qt Quick
18 Posts 3 Posters 3.5k Views 1 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.
  • J Offline
    J Offline
    Joseph Keene
    wrote on last edited by
    #1

    Hi Everyone,

    I am trying to enable arrow-key-navigation with QtVirtualKeyboard on Qt 5.15.1. However, it doesn't seem to do anything when I launch the Basic VirtualKeyboard Example. I press on my arrow keys and I don't see anything happening on the VirtualKeyboard. All I see is the cursor moving left and right in the Input box. Does anyone else have this issue?

    Here are the steps that I performed:

    1. Run qmake on the qtvirtualkeyboard.pro with the arrow-key-navigation and disable-desktop option
    qmake Qt/5.15.1/Src/qtvirtualkeyboard/qtvirtualkeyboard.pro CONFIG+=arrow-key-navigation CONFIG+=disable-desktop
    
    1. Run make and make install in the qtvirtualkeyboard directory
    cd Qt/5.15.1/Src/qtvirtualkeyboard/
    make
    make install
    
    1. After it finished installing, I imported the qtvirtualkeyboard basic example from what was installed into QtCreator.

    2. I configured the project in QtCreator to use the Kit that includes what was just rebuilt.

    3. I edited the basic.pro file to include the arrow-key-navigation and disable-desktop

    TARGET = basic
    QT += qml quick charts
    SOURCES += main.cpp
    CONFIG += link_pkgconfig
    CONFIG += disable-desktop
    CONFIG += arrow-key-navigation
    static {
        QT += svg
        QTPLUGIN += qtvirtualkeyboardplugin
    }
    ...
    

    Finally, I ran the project. I clicked on a text field. Typed in a letter. And starting pressing left and right on my keyboard, but I don't see anything happening on the VirtualKeyboard. Instead, I just see the cursor moving left and right on the text field. What did I miss?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Joseph Keene
      wrote on last edited by
      #2

      Fixed my issue. There were two parts to this issue.

      First, I needed to be inside of the directory where the .pro file is kept when regenerating the Makefile.

      cd Qt/5.15.1/Src/qtvirtualkeyboard/
      Qt/5.15.1/gcc_64/bin/qmake qtvirtualkeyboard.pro CONFIG+=arrow-key-navigation
      

      Second, I also had to rerun qmake on another .pro file as well to get it to update.

      cd Qt/515.1/Src/qtvirtualkeyboard/src/virtualkeyboard/
      Qt/5.15.1/gcc_64/bin/qmake virtualkeyboard.pro CONFIG+=arrow-key-navigation
      

      I then ran make and make install.

      cd Qt/515.1/Src/qtvirtualkeyboard/src/virtualkeyboard/
      make
      cd Qt/5.15.1/Src/qtvirtualkeyboard/
      make
      make install
      

      After importing the updated virtualkeyboard module, I was able to use my arrow-keys to navigate the keyboard. Hopefully this is helpful for someone else!

      1 Reply Last reply
      2
      • U Offline
        U Offline
        UnknownCollegeCoder
        wrote on last edited by
        #3

        Hello @Joseph-Keene. I am fairly new to Qt and I am creating a UI for an embedded application that will be using only push buttons mapped as keyboard inputs. I want to do a similar thing with the keyboard with what you have worked out here except I have had no luck so far. I am working out of Qt 6.8.2 and I am struggling with turning the configuration for the arrow key navigation on. I am working out of Qt creator on a windows machine and I can't get qmake to work. And I also don't understand the step of configuring the project in Qt creator. If you get this and understand a quick and easy fix to this problem please let me know.
        Thank You

        jsulmJ 1 Reply Last reply
        0
        • U UnknownCollegeCoder

          Hello @Joseph-Keene. I am fairly new to Qt and I am creating a UI for an embedded application that will be using only push buttons mapped as keyboard inputs. I want to do a similar thing with the keyboard with what you have worked out here except I have had no luck so far. I am working out of Qt 6.8.2 and I am struggling with turning the configuration for the arrow key navigation on. I am working out of Qt creator on a windows machine and I can't get qmake to work. And I also don't understand the step of configuring the project in Qt creator. If you get this and understand a quick and easy fix to this problem please let me know.
          Thank You

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @UnknownCollegeCoder said in Enabling arrow-key-navigation with QtVirtualKeyboard on Qt 5.15.1:

          I can't get qmake to work

          How about providing more details? What exactly does not work? What did you try?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • U Offline
            U Offline
            UnknownCollegeCoder
            wrote on last edited by
            #5

            On my Windows machine I don't have the .pro files anywhere. So when I try to run the qmake commands as shown up above there is no .pro. Is this something I have to generate? But on my linux machine when I run the qmake command I get an error saying "fatal error: QtVirtualKeyboard/private/abstractinputpanel_p.h: No such file or director #include <QqtVirtualKeyboard/private/abstractinputpanel_p.h>

            jsulmJ 1 Reply Last reply
            0
            • U UnknownCollegeCoder

              On my Windows machine I don't have the .pro files anywhere. So when I try to run the qmake commands as shown up above there is no .pro. Is this something I have to generate? But on my linux machine when I run the qmake command I get an error saying "fatal error: QtVirtualKeyboard/private/abstractinputpanel_p.h: No such file or director #include <QqtVirtualKeyboard/private/abstractinputpanel_p.h>

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @UnknownCollegeCoder Is this your own project? If you're using Qt6 then you most probably have a CMake based project, not QMake. In this case there is at least one CMakeLists.txt file and you have to use cmake instead of qmake.
              And this has absolutely nothing to do with Windows or Linux. A Qt project either uses qmake or cmake, it does not matter on which OS.

              Regarding private Qt headers: why do you need them? If you really need them then take a look at https://stackoverflow.com/questions/72416098/configure-qmake-project-file-to-include-private-header

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              U 1 Reply Last reply
              0
              • jsulmJ jsulm

                @UnknownCollegeCoder Is this your own project? If you're using Qt6 then you most probably have a CMake based project, not QMake. In this case there is at least one CMakeLists.txt file and you have to use cmake instead of qmake.
                And this has absolutely nothing to do with Windows or Linux. A Qt project either uses qmake or cmake, it does not matter on which OS.

                Regarding private Qt headers: why do you need them? If you really need them then take a look at https://stackoverflow.com/questions/72416098/configure-qmake-project-file-to-include-private-header

                U Offline
                U Offline
                UnknownCollegeCoder
                wrote on last edited by UnknownCollegeCoder
                #7

                @jsulm Yes this is my own project. I am fairly new to both qt as well as cmake and qmake stuff. As for the private header I am not trying to include that private header. I am getting an error when I try to make the .pro file. I am not sure why the private header is being included.

                My overall goal is to have a virtual keyboard that I can navigate and hit enter to type the text in. I would much rather use the defined library that way I don't have to create my own keyboard but I don't understand enough to get the variable "[-no]-vkb-arrow-keynavigation" enabled. I have tried adding this to the configuration of the project without any luck. Regarding the library and reference that I am looking at, I have attached a link below.

                Is there a separate way I should approach this? Or what do you recommend I do?

                https://doc.qt.io/qt-6/qtvirtualkeyboard-build.html#configuration-options

                jsulmJ 1 Reply Last reply
                0
                • U UnknownCollegeCoder

                  @jsulm Yes this is my own project. I am fairly new to both qt as well as cmake and qmake stuff. As for the private header I am not trying to include that private header. I am getting an error when I try to make the .pro file. I am not sure why the private header is being included.

                  My overall goal is to have a virtual keyboard that I can navigate and hit enter to type the text in. I would much rather use the defined library that way I don't have to create my own keyboard but I don't understand enough to get the variable "[-no]-vkb-arrow-keynavigation" enabled. I have tried adding this to the configuration of the project without any luck. Regarding the library and reference that I am looking at, I have attached a link below.

                  Is there a separate way I should approach this? Or what do you recommend I do?

                  https://doc.qt.io/qt-6/qtvirtualkeyboard-build.html#configuration-options

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @UnknownCollegeCoder So, do you have a *.pro file in your project or or CMakeLists.txt?
                  If I understood you correctly you can run qmake on your project on Linux. That means you have a pro file. In this case you should be able to run qmake also on Windows. How did you copy your project to Windows? "I can't get qmake to work" - this does not tell much, so please provide more details on what you did and what exactly did not work (error messages?).

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • U Offline
                    U Offline
                    UnknownCollegeCoder
                    wrote on last edited by UnknownCollegeCoder
                    #9

                    @jsulm On my windows computer I have cmake and on my linux setup I have .pro. I have a git repo setup but I only push the main project files and let Qt creator setup the project kit for me.

                    From what I understand now, I should be using cmake instead of qmake on my windows laptop and trying this same setup?

                    I would add a screenshot of the error that I am getting on the linux setup but I don't have that accessible at the moment.

                    jsulmJ 1 Reply Last reply
                    0
                    • U UnknownCollegeCoder

                      @jsulm On my windows computer I have cmake and on my linux setup I have .pro. I have a git repo setup but I only push the main project files and let Qt creator setup the project kit for me.

                      From what I understand now, I should be using cmake instead of qmake on my windows laptop and trying this same setup?

                      I would add a screenshot of the error that I am getting on the linux setup but I don't have that accessible at the moment.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @UnknownCollegeCoder I'm confused now: do you use QMake or CMake for your project?
                      "I have a git repo setup but I only push the main project files" - the pro or CMakeLists.txt files are part of the project and should also be pushed to your repo.
                      It is really simple: if you have a pro file in your project then simply use qmake on Windows and Linux. If you have CMakeLists.txt file then use cmake on Windows and Linux. It has nothing to do with the operating system!

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • U Offline
                        U Offline
                        UnknownCollegeCoder
                        wrote on last edited by UnknownCollegeCoder
                        #11

                        For my project I use Cmake I believe. Sorry for the confusion.

                        The main thing I want to understand is how to enable the arrow-keynavigation for the virtual keyboard in my project.

                        jsulmJ 1 Reply Last reply
                        0
                        • U UnknownCollegeCoder

                          For my project I use Cmake I believe. Sorry for the confusion.

                          The main thing I want to understand is how to enable the arrow-keynavigation for the virtual keyboard in my project.

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @UnknownCollegeCoder Then I don't know why you're trying to run qmake?
                          If you get error messages when compiling please post them, especially the very first one.

                          Btw. qmake does not generate compiler errors, so the error you posted did not come from qmake, but from the C++ compiler.

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • U Offline
                            U Offline
                            UnknownCollegeCoder
                            wrote on last edited by UnknownCollegeCoder
                            #13

                            @jsulm Sorry for the confusion. I have my project on both a Windows computer and a Linux computer but on each machine I have downloaded the compilers and their respective libraries. In @Joseph-Keene's example he accessed the VirtualKeyboard library to add CONFIG+=arrow-key-navigation. From my understanding to do these steps you need to have the .pro files in the respective libraries as mentioned above. However, on my windows machine there are no .pro files in these locations. Would I instead have to do something with cmake?

                            On my linux machine I tried to follow the steps shown above but when I use make after doing qmake I get this error.

                            image.png

                            Should I continue with the linux machine or is there an easier way to change this config on my windows machine?

                            If you need more context on what I am trying to do, I created a post as well. Here's the link if you want to check it out.

                            https://forum.qt.io/topic/160947/how-to-use-arrow-key-navigation-with-qtvirtualkeyboard
                            Thank You

                            jsulmJ 1 Reply Last reply
                            0
                            • U UnknownCollegeCoder

                              @jsulm Sorry for the confusion. I have my project on both a Windows computer and a Linux computer but on each machine I have downloaded the compilers and their respective libraries. In @Joseph-Keene's example he accessed the VirtualKeyboard library to add CONFIG+=arrow-key-navigation. From my understanding to do these steps you need to have the .pro files in the respective libraries as mentioned above. However, on my windows machine there are no .pro files in these locations. Would I instead have to do something with cmake?

                              On my linux machine I tried to follow the steps shown above but when I use make after doing qmake I get this error.

                              image.png

                              Should I continue with the linux machine or is there an easier way to change this config on my windows machine?

                              If you need more context on what I am trying to do, I created a post as well. Here's the link if you want to check it out.

                              https://forum.qt.io/topic/160947/how-to-use-arrow-key-navigation-with-qtvirtualkeyboard
                              Thank You

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @UnknownCollegeCoder Are you aware that @Joseph-Keene was building virtualkeyboard from Qt source code, not his own application?
                              To do this you have to download Qt source code first. If you're using Qt6 you will have to use cmake to build virtualkeyboard.
                              Here is official documentation how to build Qt (but you don't have to build everything, only virtualkeyboard): https://wiki.qt.io/Building_Qt_6_from_Git

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              1
                              • U Offline
                                U Offline
                                UnknownCollegeCoder
                                wrote on last edited by
                                #15

                                @jsulm No this is not what I want to. I did not realize this.

                                I will try to give you a better explanation. I am creating a project on a Windows computer using QtCreator and cmake. I want to use the virtualKeyboard library but I only have the option of using arrow keys to navigate the keyboard. So when the keyboard comes on the screen I want a letter to be highlighted which can be moved around using the arrow keys. I noticed the virtualKeyboard library has a configuration for the arrow keys to be enabled but it is initially set to disabled. I am fairly new to this so I don't quite understand how to actually enable this configuration.

                                jsulmJ 1 Reply Last reply
                                0
                                • U UnknownCollegeCoder

                                  @jsulm No this is not what I want to. I did not realize this.

                                  I will try to give you a better explanation. I am creating a project on a Windows computer using QtCreator and cmake. I want to use the virtualKeyboard library but I only have the option of using arrow keys to navigate the keyboard. So when the keyboard comes on the screen I want a letter to be highlighted which can be moved around using the arrow keys. I noticed the virtualKeyboard library has a configuration for the arrow keys to be enabled but it is initially set to disabled. I am fairly new to this so I don't quite understand how to actually enable this configuration.

                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  @UnknownCollegeCoder said in Enabling arrow-key-navigation with QtVirtualKeyboard on Qt 5.15.1:

                                  I don't quite understand how to actually enable this configuration.

                                  Like @Joseph-Keene shown. But that requires that you build virtualkeyboard by yourself.

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  U 1 Reply Last reply
                                  1
                                  • jsulmJ jsulm

                                    @UnknownCollegeCoder said in Enabling arrow-key-navigation with QtVirtualKeyboard on Qt 5.15.1:

                                    I don't quite understand how to actually enable this configuration.

                                    Like @Joseph-Keene shown. But that requires that you build virtualkeyboard by yourself.

                                    U Offline
                                    U Offline
                                    UnknownCollegeCoder
                                    wrote on last edited by
                                    #17

                                    @jsulm Ok. On my Linux machine I went to my Qt main directory and did ./configure -vkb-arrow-keynavigation which now in my configure list it has "Key navigation ..........................yes" which I believe means it is enabled.

                                    Would you happen to know how I get this configuration to my current project? I am just trying to use the basic keyboard example that Qt provides. I have added an input panel which sets the focus to itself once completed. I know the keyboard has the focus but arrow keys aren't showing up yet. So I am pretty sure that this configuration isn't making it to my project. But I am unsure how to get this to my project.

                                    jsulmJ 1 Reply Last reply
                                    0
                                    • U UnknownCollegeCoder

                                      @jsulm Ok. On my Linux machine I went to my Qt main directory and did ./configure -vkb-arrow-keynavigation which now in my configure list it has "Key navigation ..........................yes" which I believe means it is enabled.

                                      Would you happen to know how I get this configuration to my current project? I am just trying to use the basic keyboard example that Qt provides. I have added an input panel which sets the focus to itself once completed. I know the keyboard has the focus but arrow keys aren't showing up yet. So I am pretty sure that this configuration isn't making it to my project. But I am unsure how to get this to my project.

                                      jsulmJ Offline
                                      jsulmJ Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #18

                                      @UnknownCollegeCoder said in Enabling arrow-key-navigation with QtVirtualKeyboard on Qt 5.15.1:

                                      Would you happen to know how I get this configuration to my current project?

                                      You don't! Again: this instruction is to BUILD Qt virtualkeyboard itself, not your project! After calling configure you call make and then "make install" (just like @Joseph-Keene shown already).

                                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      1 Reply Last reply
                                      1
                                      • SGaistS SGaist referenced this topic on

                                      • Login

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