Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Keyboard Initialisation without using the mouse --Deployment
Forum Updated to NodeBB v4.3 + New Features

Keyboard Initialisation without using the mouse --Deployment

Scheduled Pinned Locked Moved Installation and Deployment
6 Posts 2 Posters 2.7k 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.
  • L Offline
    L Offline
    lsatenstein
    wrote on last edited by
    #1

    Under Linux I have to deliver an application that does not use the mouse. I believe I setup everything ok, and here is the problem.
    On one system, on program startup, the keyboard is active and the Qt MainWindow application recognizes the keyboard input as expected.

    On some other Linux systems, including the one on which I am developing, (I am trying different test platforms), the identical Qt from same 4.74 version and identical source code is blocked. By blocked, I mean that the application does not recognize keyboard entries until a) I use the alt-tab to move to another desktop and return, or b) if I click anywhere on active Qt application screen with the mouse, from then on the Qt application recognizes the keyboard.

    Any clues as to what I can do to circumvent this initialisation problem? The application is using buttons throughout. Tabbing to the button and hitting enter works once past initialisation.

    I am a true beginner in C++ (I come from 25 years of C programming), so I am experiencing a new world of C++ and Qt.

    Is this a Qt bug with 4.7.4?

    This is my trains of thought, after reading about mouseevents.
    a) create a method in MainWindow::InitializeKeyboard() and have that method signal a mouseclick using coordinates of the first button. I believe that by doing this action, it will initialize the Qt code and also the keyboard recognition.

    b) Call for help from this forum

    c) Both a) and b).

    If you can help, I will be grateful. I am already late for resolving this problem.

    I have crossposted to Development forum
    Thanks in advance

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Hi,

      I assume, that the app has no input focus due to some strange reason. If there is input focus on the app, tab could move the focus to any widget, if not, you can even not emulate a mouse event with qt, it will not get the focus then.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lsatenstein
        wrote on last edited by
        #3

        But with the physical mouse, the first mouseClick on a button causes focus to be made, Qt is initialized for keyboard and I am there ready to go.

        In my method, is this going to work, where tab_1 is my widget?

        QTest::mouseClick(QWidget *tab_1,Qt::MouseButton(leftButton));

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lsatenstein
          wrote on last edited by
          #4

          Am I posting to the right area?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on last edited by
            #5

            [quote author="lsatenstein" date="1322685918"]
            QTest::mouseClick(QWidget *tab_1,Qt::MouseButton(leftButton));
            [/quote]

            First: This calls the internal mouse event but wil never set the focus to the application, if it is currently on another app. putting the focus between apps is an OS thing.

            Second: The keyboard does not need to be initialized. It exists and the OS handles it. The key events are sent to the app, that currently has got the input focus.

            I'm not 100 % sure, whether you can tweak in Linux to grab the input focus from an app, on Windows it is impossible as the OS forbids it. The only thing would be to initiate an OS mouse click, which is not possible with Qt, this must be done via OS API.

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lsatenstein
              wrote on last edited by
              #6

              Good Sunday morning all.

              Here is some new information about the inactive keyboard on startup.

              It only happens with GRUB3 . If I test with a Linux using grub2 (debian), or older Fedora (14) the keyboard is active.
              Otherwise it takes a focus switch at the operating system level, or a mouse-click anywhere after which the keyboard is active.

              For example, the problem is with current UBUNTU 10.4.3 and more recent and current version of Fedora (16).

              Linux Mint 12 is OK, as is Debian.

              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