No, nothing. If there is only one child it is the active child on all my MDI apps under Linux/Windows. How are you adding these sub-windows to the MDI area?
No, nothing. If there is only one child it is the active child on all my MDI apps under Linux/Windows. How are you adding these sub-windows to the MDI area?
Hi
Here is the code which creates the children.
Qt Code:
bool MainWindow::LoadRecentFiles() { if(!recentFiles.empty()) { for (int x = 0; x < (recentFiles.size()); ++x) { ceguSubWidget *child = new ceguSubWidget(); mdiArea->addSubWindow(child); if (child->load(recentFiles.at(x))) child->show(); else child->close(); } return true; } else return false; }To copy to clipboard, switch view to plain text mode
Thanks
Some observations and questions.
- Do you want to capture the return value from addSubWindow and use show() and close() against that?
- Perhaps only add the sub window if the child successfully opens the recent file (but be careful to delete if it fails).
- Your method can return true even if none of the recent files could be opened.
- Does your ceguSubWidget class set Qt::WA_DeleteOnClose (see the QMdiArea::addSubWindow() docs)? This affects focus behaviour of the remaining windows when close() is called.
parsnips146 (23rd August 2010)
The ceguSub Wiget does have the deleteonclose option set when it is created.
I have modified the creation code but it still has the same problems.
Qt Code:
bool MainWindow::LoadRecentFiles() { if(!recentFiles.empty()) { for (int x = 0; x < (recentFiles.size()); ++x) { ceguSubWidget *child = new ceguSubWidget(); if (mdiArea->addSubWindow(child)) { if (child->load(recentFiles.at(x))) { child->show(); return true; } else { child->close(); return false; } } } } return false; }To copy to clipboard, switch view to plain text mode
I have found the issue it was that load RecentFiles was called before the mainwindow had been set to show.
thanks for your help
James
Excellent.
On closer reading it seems my Qt::WA_DeleteOnClose comment only applies to the QMdiSubWindow and not its contents anyway.
Bookmarks