PDA

View Full Version : What event am I looking for?



sdfisher
28th July 2007, 16:24
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?

fullmetalcoder
28th July 2007, 16:56
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...

jpn
6th August 2007, 19:57
By the way, there is also QEvent::WindowActivate (http://doc.trolltech.com/4.3/qevent.html#Type-enum). Activating a window does not necessarily transfer focus to the corresponding window on all window systems / configurations.