[Qt-interest] Bug in QMdiArea or QMdiSubWindow wrt QCloseEvent under Linux but not Windows?

rajasekharan websweetweb at gmail.com
Sun Jun 14 04:19:57 CEST 2009


Andreas,

What method are you using in your QMainWindow to check if all the sub 
windows of the QMdiArea are closed?

I have created an application with QMdiArea in Windows and Linux but 
didn't come across this issue. It worked correctly.

In the QMainWindow's close event I used:

mdiArea->closeAllSubWindows();
if (midArea->subWindowList().size() > 0)
{
     closeEvent->reject();
}
else
{
     closeEvent->accept();
}

Raj

Andreas Ntaflos wrote:
> Hi all,
>
> I believe I have found a bug in QMdiArea or QMdiSubWindow that is
> present at least in the Linux/X11 open source version of Qt 4.5.1
> (directly from the Qt Software website). It is best reproducible with
> the MDI example application (examples/mainwindows/mdi) which lets you
> open a text file into a QTextEdit. When the MDI application is closed
> without saving the changes made to the file a dialog pops up, asking
> if the changes should be saved, discarded or if the exiting should be
> cancelled.
>
> Now under Windows XP SP2, Qt 4.5.1 from Qt Software pressing Cancel
> results in cancelling the application exit, as one would expect. The
> program keeps running. But under X11/Linux (Ubuntu 8.04 here, Qt
> 4.5.1 from Qt Software) pressing Cancel still results in the
> application exiting.
>
> This is easily reproducible if one has access to both an X11/Linux and
> a Windows installation of Qt.
>
> I believe the problem is that the QMdiSubWindow doesn't correctly
> ignore the QCloseEvent it gets, or the QMainWindow or QMdiArea
> doesn't correctly acknowledge that the QMdiSubWindow has ignored the
> event. Note that the Application example, which uses only the
> QMainWindow API but not QMdiArea/QMdiSubWindow, doesn't exhibit this
> behaviour. The problem also doesn't appear when trying to close only
> the QMdiSubWindow in which the changes have been made but not saved.
> There pressing Cancel correctly results in the QMdiSubWindow ignoring
> the QCloseEvent.
>
> Can anyone confirm?
>
> Andreas
>    
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090614/ff764963/attachment.html 


More information about the Qt-interest-old mailing list