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. Lost Focus with QProcess
Forum Updated to NodeBB v4.3 + New Features

Lost Focus with QProcess

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.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
    JoraPiter
    wrote on last edited by
    #1

    Hello!
    I have a program that performs a function as a dispatcher, and launches other applications (3-4) by QProcess.
    The applications runs in full screen mode. And all the time the user can be seen only one application. Switching between them is realized through the pipe.
    Thus, when we switch, one application is hidden (setvisible (false)) else just appears (setvisible (true)).
    Sometimes! focus is lost, and the running application is not responding to keystrokes.
    I tried do setFocus (),
    setActivateWindow () (the documentation says that the application should be in the top level but this did not occur)
    tried to implement window activation and set focus by a library X11, but also useless.
    It is noteworthy that sometimes the focus of work, and sometimes not.
    Tested on Ubuntu 10.04, 10.10, 11.10 (x86, x64). Everywhere one and the same problem. Version of Qt 4.7.4
    Tell me what i can do here?
    thanks in advance

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      Once you spawn a process with QProcess, the child becomes its own entity and the spawning program doesn't control the child process's visibility or focus.

      The child process isn't a child window of your application.

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JoraPiter
        wrote on last edited by
        #3

        I understand. I do not setfocus() in the main application (dispatcher).
        I do setfocus() in child applications when they got the command "show" through Pipe.
        And those child's applications lost focus.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          miroslav
          wrote on last edited by
          #4

          You may want to look at activate() or raise() for the top level window. Focus is a concept within one window. Probably your child process does not loose focus, but discontinues to be the active window.

          Mirko Boehm | mirko@kde.org | KDE e.V.
          FSFE Fellow
          Qt Certified Specialist

          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