summaryrefslogtreecommitdiffstats
path: root/doc/src/howtos/restoring-geometry.qdoc
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-08-21 05:22:59 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-08-21 05:22:59 (GMT)
commit9093368f33ddc422047103a89effcd40338b4dbc (patch)
tree78c9660b403214de7ba793c9b06bbb0b65cd5eac /doc/src/howtos/restoring-geometry.qdoc
parent5365c1cdf1e79b60f913f8fba2b5a25058d65b5c (diff)
parent1af6fc12def29e3f44dd7fcf5635c688902f29c8 (diff)
downloadQt-9093368f33ddc422047103a89effcd40338b4dbc.zip
Qt-9093368f33ddc422047103a89effcd40338b4dbc.tar.gz
Qt-9093368f33ddc422047103a89effcd40338b4dbc.tar.bz2
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
Diffstat (limited to 'doc/src/howtos/restoring-geometry.qdoc')
-rw-r--r--doc/src/howtos/restoring-geometry.qdoc39
1 files changed, 17 insertions, 22 deletions
diff --git a/doc/src/howtos/restoring-geometry.qdoc b/doc/src/howtos/restoring-geometry.qdoc
index c9e6f4f..cc6f3e1 100644
--- a/doc/src/howtos/restoring-geometry.qdoc
+++ b/doc/src/howtos/restoring-geometry.qdoc
@@ -45,25 +45,28 @@
\ingroup best-practices
- This document describes how to save and restore a window's
- geometry using the geometry properties. On Windows, this is
- basically storing the result of QWidget::geometry() and calling
- QWidget::setGeometry() in the next session before calling
- \l{QWidget::show()}{show()}.
+ This document describes how to save and restore a \l{Window
+ Geometry}{window's geometry} using the geometry properties. On
+ Windows, this is basically storing the result of
+ QWidget::geometry() and calling QWidget::setGeometry() in the next
+ session before calling \l{QWidget::show()}{show()}.
- On X11, this won't work because an invisible window doesn't have
- a frame yet. The window manager will decorate the window later.
- When this happens, the window shifts towards the bottom/right
- corner of the screen depending on the size of the decoration frame.
- Although X provides a way to avoid this shift, most window managers
- fail to implement this feature.
+ On X11, this might not work because an invisible window does not
+ have a frame yet. The window manager will decorate the window
+ later. When this happens, the window shifts towards the
+ bottom/right corner of the screen depending on the size of the
+ decoration frame. Although X provides a way to avoid this shift,
+ some window managers fail to implement this feature.
Since version 4.2, Qt provides functions that saves and restores a
window's geometry and state for you. QWidget::saveGeometry()
saves the window geometry and maximized/fullscreen state, while
QWidget::restoreGeometry() restores it. The restore function also
checks if the restored geometry is outside the available screen
- geometry, and modifies it as appropriate if it is.
+ geometry, and modifies it as appropriate if it is:
+
+ \snippet doc/src/snippets/code/src_gui_widgets_qmainwindow.cpp 0
+ \snippet doc/src/snippets/code/src_gui_widgets_qmainwindow.cpp 1
If those functions are not available or cannot be used, then a
workaround is to call \l{QWidget::setGeometry()}{setGeometry()}
@@ -74,14 +77,6 @@
\l{QWidget::pos()}{pos()} and \l{QWidget::size()}{size()} and to
restore the geometry using \l{QWidget::resize()} and
\l{QWidget::move()}{move()} before calling
- \l{QWidget::show()}{show()}, as demonstrated in the following
- code snippets (from the \l{mainwindows/application}{Application}
- example):
-
- \snippet examples/mainwindows/application/mainwindow.cpp 35
- \codeline
- \snippet examples/mainwindows/application/mainwindow.cpp 38
-
- This method works on Windows, Mac OS X, and most X11 window
- managers.
+ \l{QWidget::show()}{show()}, as demonstrated in the
+ \l{mainwindows/application}{Application} example.
*/