Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
4.4.0
-
None
Description
QWidget::saveGeometry() and QWidget::restoreGeometry() does not work well for QMdi Windows.
This is because restoreGeometry() uses the desktop's geometry to constraint the widgets position and
size. It would be better, to use the parent's (QWorkspace) geometry
if the window is a QWorkspaceChild. The desktop's geometry could be
used, if it is a toplevel widget.
The documentation says saveGeometry() and restoreGeometry()
are only to be used for toplevel widgets. So it is documented behaviour.
But the attached little patch for qwidget.cpp would give this
feature.
--- qwidget.orig.cpp Mon Oct 01 13:59:42 2007 +++ qwidget.cpp Wed Feb 06 18:54:12 2008 @@ -5065,7 +5065,11 @@ if (restoredScreenNumber >= desktop->numScreens()) restoredScreenNumber = desktop->primaryScreen(); - const QRect availableGeometry = desktop->availableGeometry(restoredScreenNumber); + QRect availableGeometry; + if (parentWidget()) + availableGeometry = parentWidget()->geometry(); + else + availableGeometry = desktop->availableGeometry(restoredScreenNumber); // Modify the restored geometry if we are about to restore to coordinates // that would make the window "lost". This happens if:
Attachments
Issue Links
- is duplicated by
-
QTBUG-7634 QMdiSubWindows do not properly restore their positions using the inherited restoreGeometry() function (X11 only)
-
- Closed
-
-
QTBUG-18648 Mdi windows save&restore geometry on dual monitors
-
- Closed
-
-
QTBUG-1255 Add functionality to save/restoreGeometry() and state for QMdiArea and its QMdiSubWindows
-
- Closed
-