+ Reply to Thread
Results 1 to 4 of 4

Thread: Window focus issues (How to force focus to a window?)

  1. #1
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Window focus issues (How to force focus to a window?)

    I have a non-fullscreen Qt application running on top of a browser on an embedded device.
    Now, if i click outside the Qt application, it loses focus and doesn't get keyboard events. Is there any way to force focus so that it never loses focus even if someone clicks outside the Qt window?

    When the application loses focus, i am able to trap the focus out event, but i don't know how to force the focus back to my application after trapping focus out event.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 160 Times in 150 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Window focus issues (How to force focus to a window?)


  3. #3
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Window focus issues (How to force focus to a window?)

    Actually i already tried grabKeyboard() before creating this thread. It was working on my desktop and i wasn't sure if it'll work on the embedded device properly.
    But i just tested in on the device and it seems to work

    The problem was getting the Window Deactivation event on the embedded device. The device doesn't have a window manager so i don't get any event when user clicks outside the window. So, i tried trapping FocusOut event instead and it's working fine.

    I had some -ve thoughts about grabKeyboard that if i do grabKeyboard on my main widget in the Qt window, it won't allow me to transfer focus to other widgets, but it's working fine.

  4. #4
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Window focus issues (How to force focus to a window?)

    1 small query:
    I am getting focus lost event when user clicks outside the Qt window.
    Now, if the mouse cursor is not there i.e. someone disables the mouse cursor on the embedded device (since the device is touchscreen, the cursor may not be visible) i should still get the focus lost event, right?

+ Reply to Thread

Similar Threads

  1. Popup notification window issues on Mac
    By alexandersv in forum Qt Programming
    Replies: 2
    Last Post: 20th April 2012, 11:15
  2. QGLWidget window redrawing contents when losing focus
    By Barry79 in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2009, 13:37
  3. Force focus to a QTabWidget page's widget
    By thomaspu in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2008, 06:54
  4. Replies: 4
    Last Post: 4th June 2007, 12:07
  5. Focus issues / Setting multiple focus
    By ComputerPhreak in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2007, 06:09

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