Lost Focus with QProcess



  • 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


  • Moderators

    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.



  • 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.



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.