[Qt-interest] Minimizing Mfc application with open Qt dialog

elizabeta petreska elizabeta.petreska at gmail.com
Sat Sep 26 21:04:26 CEST 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090926/3a93546c/attachment.html 


More information about the Qt-interest-old mailing list