There's the screenshot of how the app looks like before I switch spaces, and how it should look like after I switch back. As you can see, there is one QMainWindow with two QDialogs over it. The dialog in question is a child of another QDialog.
!http://dl.dropbox.com/u/43071740/QDialogVSSpaces/Step1.png(http://dl.dropbox.com/u/43071740/QDialogVSSpaces/Step1.png)!
The Space Overview, right before I switch back from another Space:
!http://dl.dropbox.com/u/43071740/QDialogVSSpaces/Step2.png(http://dl.dropbox.com/u/43071740/QDialogVSSpaces/Step2.png)!
What happens after I clicked on the app again.
!http://dl.dropbox.com/u/43071740/QDialogVSSpaces/Step3.png(http://dl.dropbox.com/u/43071740/QDialogVSSpaces/Step3.png)!
Another few things. I've change the parent Dialog to display a debug message after it returns from the child dialog's exec():
@ CFit4PointsDlg* pkDlg = new CFit4PointsDlg( this, &init );
pkDlg->setModal( true );
pkDlg->exec();
qDebug() << "\tReturn from Fit4PointsDlg->exec()";
delete pkDlg;@
The debug message never showed up.
I even override the child dialog's event handlers and slots:
@/*******************************************************************
Reimplemented slots
*******************************************************************/
void CFit4PointsDlg::accept()
{
#ifdef _DEBUG
qDebug() << "[Fit4PointsDlg][accept] ACCEPTED";
#endif
QDialog::accept();
}
void CFit4PointsDlg::done( int r )
{
#ifdef _DEBUG
qDebug() << "[Fit4PointsDlg][done] DONE";
#endif
QDialog::done( r );
}
void CFit4PointsDlg::reject()
{
#ifdef _DEBUG
qDebug() << "[Fit4PointsDlg][reject] REJECTED";
#endif
QDialog::reject();
}
void CFit4PointsDlg::lower()
{
#ifdef _DEBUG
qDebug() << "[Fit4PointsDlg][lower] LOWERED";
#endif
QDialog::lower();
}
void CFit4PointsDlg::setFocus()
{
#ifdef _DEBUG
qDebug() << "[Fit4PointsDlg][setFocus] Set Keyboard Focus";
#endif
QDialog::setFocus();
}
/*******************************************************************
*
Reimplemented functions
*******************************************************************/
void CFit4PointsDlg::closeEvent ( QCloseEvent * e )
{
#ifdef _DEBUG
qDebug() << "[Fit4PointsDlg][closeEvent] CLOSED";
#endif
QDialog::closeEvent( e );
}
void CFit4PointsDlg::hideEvent ( QHideEvent * event )
{
#ifdef _DEBUG
qDebug() << "[Fit4PointsDlg][hideEvent] HIDDEN";
#endif
QDialog::hideEvent( event );
}
void CFit4PointsDlg::moveEvent( QMoveEvent * event )
{
#ifdef _DEBUG
qDebug() << "[Fit4PointsDlg][moveEvent] MOVED " << event->oldPos() << "=>" << event->pos();
#endif
QDialog::moveEvent( event );
}
void CFit4PointsDlg::focusInEvent( QFocusEvent * event )
{
#ifdef _DEBUG
qDebug() << "[Fit4PointsDlg][focusInEvent] FOCUS IN " << endl
<< "\tparent: " << this->parentWidget();
#endif
QDialog::focusInEvent( event );
}
void CFit4PointsDlg::focusOutEvent( QFocusEvent * event )
{
#ifdef _DEBUG
qDebug() << "[Fit4PointsDlg][focusOutEvent] FOCUS OUT " << endl
<< "\tparent: " << this->parentWidget();
#endif
QDialog::focusOutEvent( event );
}
void CFit4PointsDlg::setVisible ( bool visible )
{
#ifdef _DEBUG
qDebug() << "[Fit4PointsDlg][setVisible] Set Visible " << visible;
#endif
QDialog::setVisible( visible );
}@
The only functions that might responded during switching back to the Space and having the child dialog disappear is the FocusIn/Out event handlers. I was hoping somwthing will happen with hideEvent as well, but it's debug message never shows during this event.
Also, on some rare occasions, the child dialog might reappear (This is something rather erratic; I've yet to find out how to reproduce this). When it does, it will appear that the child dialog no longer has the parent dialog as a parent anymore; came to that conclusion because moving the parent dialog doesn't affect the child dialog's position anymore, as it normally does. I searched my code and was pretty sure I never explicitly reset the child dialog's parent. Maybe there's something else doing that without me knowing?