Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.0
-
None
-
mac coca on leopard 32bit
-
-
464306df827cbf3378f72f9aead0448a32ab5a21
Description
popup QDialog's are not returning focus/active window status to the previously active/focused window after they go away, only in the cocoa version (carbon works fine as it has in prior versions). for example, the clicked() signal on a button is connected to a popup dialog, and when I tab over to that button, hit the space bar, get the popup, select something, and then close it, the previous window is no longer active.
this is in an application with multiple QMainWindow's – it is always re-activating the first such window that was created.
to create a work-around, we have a sub-classed QDialog called iDialog, to which I added a new exec() function as shown below. My first attempt to fix the but using QApplication::setActiveWindow failed, but using the activateWindow() call directly works! perhaps this problem with setActiveWindow is the source of the problem in the first place?
int iDialog::exec() {
// we're losing focus here so need to restore it!!
#ifdef TA_OS_MAC
QPointer<QWidget> m_prev_active = QApplication::activeWindow();
#endif
int rval = QDialog::exec();
#ifdef TA_OS_MAC
if((bool)m_prev_active)
#endif
return rval;
}