Hi group,
I have been experimenting with the MDI example program. I wanted to change the child Mdi windows from the standard QTextedit to something else (an activeX control eventually...) but I am having some trouble with the basics. When I change the MdiChild object inheritance from QTextEdit to QMdiSubWindow,
e.g.
class MdiChild : public QMdiSubWindow //QTextEdit
everything works fine until I close the app (via the topright mainwindow x icon). First click all the child windows disappear (tested with up to 3 visible) but the app does not close. Clicking again and the app exits normally.
So I stripped out almost everything to make a very lightweight project but changing the above class declaration to QTextEdit (or QLabel) makes everything normally and flipping back to QMdiSubWindow causes the problem again.
It turns out that in
{
mdiArea->closeAllSubWindows();
if (mdiArea->currentSubWindow()) {
event->ignore();
} else {
event->accept();
}
}
void MainWindow::closeEvent(QCloseEvent *event)
{
mdiArea->closeAllSubWindows();
if (mdiArea->currentSubWindow()) {
event->ignore();
} else {
event->accept();
}
}
To copy to clipboard, switch view to plain text mode
currentSubWindow is returning True in one case but False (as it should) when the declaration is QTextEdit. Anybody know why?
I have attached the stripped down project that reproduces the problem. Any help would be appreciated.
Thanks,
epsilon
Bookmarks