Results 1 to 3 of 3

Thread: What event am I looking for?

  1. #1
    Join Date
    Feb 2007
    Posts
    27
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default What event am I looking for?

    I want to run some code whenever a specific (non-floating) window in my application is activated. I also need this code to run whenever the user switches to my application (with this specific window on top). What event(s) or slot(s) am I looking for?

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What event am I looking for?

    I'd think that QWidget::focusInEvent() and QWidget::focusOutEvent() would prove interesting. Think about checking the QFocusEvent::reason() to determine whether or not your code should be executed...
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: What event am I looking for?

    By the way, there is also QEvent::WindowActivate. Activating a window does not necessarily transfer focus to the corresponding window on all window systems / configurations.
    J-P Nurmi

Similar Threads

  1. QDockWidget-title
    By moowy in forum Qt Programming
    Replies: 18
    Last Post: 23rd April 2014, 20:13
  2. Create new an event, help me?
    By dungsivn in forum Qt Programming
    Replies: 6
    Last Post: 4th July 2007, 11:22
  3. The event fired by the mouse click on the frame
    By Placido Currò in forum Qt Programming
    Replies: 8
    Last Post: 3rd March 2007, 09:05
  4. pixmap onmousemove event help
    By bluesguy82 in forum Qt Programming
    Replies: 11
    Last Post: 9th August 2006, 14:15
  5. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55

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.