Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Virtual keyboard unfocus possible with Qt ?
Forum Updated to NodeBB v4.3 + New Features

Virtual keyboard unfocus possible with Qt ?

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 6.3k 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.
  • B Offline
    B Offline
    Bloops
    wrote on last edited by
    #1

    Hi .

    I try to make a little virtual keyboard in c++ with Qt.

    I maked all code and normally he should works fine . But my currently problem is when I when try to wrote (by exemple) in a notepad.

    My virtual keyboard get the focus when i click on him (with my 2 versions linux and windows) so when I try to get the active windows (it returns me my keyboard ><).

    for my example I put the code of my keyboard for windows :

    this is to define the actual current window :

    @HWND Fore = GetForegroundWindow();
    QWidget *test=QWidget::find((HWND)Fore);

        QMessageBox::information(this,"test",test->windowTitle());@
    

    I inclue <windows.h> for this one but I think (QApplication::activeWindow() work fine too) .

    I tried this for restrict the focus on my keyboard :

    @ this->setWindowFlags(Qt::WindowStaysOnTopHint);
    this->setFocusPolicy(Qt::NoFocus);@

    WindowsStaysOnTopHint it's for block my keyboard to the top of screen .

    setFocusPolicy(Qt::NoFocus) it's for try to denied the focus (didn't work :s) .

    So I write you to find help on my probleme . Does Qt really takes care about focus of OS ? If it's possible how can I reject the focus ?

    PS:sorry for my bad english Q_Q it isn't my native language

    Thanks a lot for your help and see you soon ;) .

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bloops
      wrote on last edited by
      #2

      Nobody have a solution ?

      This probleme must be important I think so :x .

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tobias.hunger
        wrote on last edited by
        #3

        Have you tried focusing some other widget that does not need the keyboard? I have not tried doing that, but would expect that to work.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bloops
          wrote on last edited by
          #4

          [quote author="Tobias Hunger" date="1333043397"]Have you tried focusing some other widget that does not need the keyboard? I have not tried doing that, but would expect that to work.[/quote]

          I think you speak focus the other app .

          And Yes, with all my test I perm check if I click on the notepad write zone (the cursor appear on it). But when I click on a button of my keyboard to wrote a character in notepad (extern app) my keyboard get the focus .

          So when i tried to define who have the focus that return me my keyboard :/ .

          I explain my exemple with a notepad,but that can be a cmd,word doc,etc,etc .., that why I need to determinate the window who have focus .

          I hope to be included with this explanation: x, sorry again for my English medium

          but thanks Tobias to help me ;)

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on last edited by
            #5

            No, I was not referring to which application has the focus but which widget in that application has it. If you focus a text edit, then it makes sense for the keyboard to pop up. If you move focus to some button or something that does not allow text input, then I would expect the keyboard to hide again.

            Most likely there are also direct means to control the keyboard (maybe platform specific)... but as I already said, I work on the desktop most of the time and never had to bother much with virtual keyboards there. Sorry.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              Bloops
              wrote on last edited by
              #6

              oh Ok .

              I need te explain more of my project :P .

              I actually devellop an application for the agriculture . My program will be installed on a linux OS (debian) , and this pc-board will be mounted on a vehicle resembling a "wheelbarrow" .

              The screen is a touch screen so we need use virtual keyboard for use my app and the OS too.
              By default on this OS GOK permit to get a virtual keyboard ,but it is very ugly and when i call him with my application (QProcess::startDetached("GOK --keyboard") ) it is contain little bug .

              So I decided to make a virtual keyboard .

              First I make the keyboard for QWidget (my app is the parent of it) with help of multi tutorial on web . It works fine, but just for my app :/ .

              So I tried since 2 weeks to make a "general" virtual keyboard (detect automatically the focussed windows).

              That why I cant just restrict the focused window when I use my keyboard, because it must be general and works with all app installed on Debian and with Debian too :x.

              It's for that I post this thread for know if Qt can be stop the focus on app ? Because without this we can't determined the real focused app in background.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                Bloops
                wrote on last edited by
                #7

                little bump ;) .

                nobody have other solutions ? :x

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  Bloops
                  wrote on last edited by
                  #8

                  little bump of last chance ?

                  Impossible problem ? :x

                  1 Reply Last reply
                  0
                  • E Offline
                    E Offline
                    edup
                    wrote on last edited by
                    #9

                    Hi Bloops,

                    Did you solve your problem? Is your code opensource? Can you share the solution?

                    Thanks

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      Macro
                      wrote on last edited by
                      #10

                      Hi... Please check this link. This might help someone with the same problem.

                      "http://qt-project.org/forums/viewthread/47407/#194982":

                      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