Results 1 to 2 of 2

Thread: lost Focus with QProcess

  1. #1
    Join Date
    Mar 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default 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

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: lost Focus with QProcess

    You can't set focus (nor activate window) on a widget unless it's visible.
    As X11 is asynchronous I'm guessing that sometimes setFocus()/activateWindow() is processed faster than show().
    Use single shot timer with short delay to activate/set focus on the window.

Similar Threads

  1. QTableWidget select row after focus is lost?
    By grantbj74 in forum Newbie
    Replies: 2
    Last Post: 19th January 2012, 23:22
  2. QMainWindow how to know when focus lost?
    By arkaha in forum Newbie
    Replies: 1
    Last Post: 12th February 2010, 06:26
  3. Focus lost
    By franco.amato in forum Qt Programming
    Replies: 1
    Last Post: 25th January 2010, 22:07
  4. How detective lost focus application ?
    By Torsten in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2008, 14:19
  5. QLineEdit lost focus
    By codebehind in forum Newbie
    Replies: 5
    Last Post: 4th May 2007, 16:02

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.