PDA

View Full Version : Minimizing Mfc application with open Qt dialog



elizabeth.h1
26th September 2009, 21:08
Hello

I am using QtWinMigrate solution to show dialogs from my plugin dlls that are loaded in third party Mfc application. The problem is the following :

When I minimize the main window of my Mfc application, and when I restore it back again, all of my open Qt dialogs are lost. I found out that actually my Qt dialogs are destroyed i.e destructors are called.

I did some debugging and discovered the following :

When I close my Mfc main window my Qt dialog gets WM_SHOWWINDOW message with SW_PARENTCLOSING wparam parametar. Then QtWndProc is called, which for the SW_PARENTCLOSING case issues sends QHideEvent:

in QtWndProc() function in file qapplication_win.cpp line 2160



case WM_SHOWWINDOW :
if(lparam==SW_PARENTCLOSING) {
QHideEvent e;
qt_sendSpontaneousEvent(widget,e);
widget->hideChildren(true); ////////////////////


and the eventFilter of QWinWidget sends DefferedDelete who deletes my dialog :

in QWinWidget.cpp in line 280



QWinWidget::eventFilter(OObject* o, QEvent* e)
{
....
case QEvent::Hide:
if(w->testAtrribute(Qt::WA_DeleteOnClose)
deleteLater();
}


Can someone please explain this behavior to me? This seems like bug to me .

Thanks