summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2023-03-17 13:43:39 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-17 15:16:37 +0000
commit8e4807fe82ea4e6c0d8b9ef23f3c9431f3e83b8f (patch)
treec6a9542c5582595e032ef7770f58052541ce2d8b
parentb19cf820b7b025d3c098fa5e592b434dfcd70e61 (diff)
doc: Add note about platform support for window positions
On some platforms, such as Wayland (and also eglfs), manual window positioning is not supported. Since this has caused confusion in the past, we add a note to the documentation. Fixes: QTBUG-86780 Change-Id: Idf8dcdfad8ccfb9eb0f704fce05216562e433e20 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 5c7a3ea783b780bc5f924849091f1f3ffb4b892c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/gui/kernel/qwindow.cpp8
-rw-r--r--src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc9
-rw-r--r--src/widgets/kernel/qwidget.cpp4
3 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index b72471d9aa..0d931c5235 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1890,6 +1890,10 @@ void QWindow::setFramePosition(const QPoint &point)
For interactively moving windows, see startSystemMove(). For interactively
resizing windows, see startSystemResize().
+ \note Not all windowing systems support setting or querying top level window positions.
+ On such a system, programmatically moving windows may not have any effect, and artificial
+ values may be returned for the current positions, such as \c QPoint(0, 0).
+
\sa position(), startSystemMove()
*/
void QWindow::setPosition(const QPoint &pt)
@@ -1913,6 +1917,10 @@ void QWindow::setPosition(int posx, int posy)
\fn QPoint QWindow::position() const
\brief Returns the position of the window on the desktop excluding any window frame
+ \note Not all windowing systems support setting or querying top level window positions.
+ On such a system, programmatically moving windows may not have any effect, and artificial
+ values may be returned for the current positions, such as \c QPoint(0, 0).
+
\sa setPosition()
*/
diff --git a/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc b/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc
index 9935c3ca7f..e8cf37329f 100644
--- a/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc
+++ b/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc
@@ -139,6 +139,15 @@
depends on the result of QWidget::frameGeometry() and the
capability of the window manager to do proper window placement,
neither of which can be guaranteed.
+
+ \section2 Wayland Peculiarities
+
+ On Wayland, programmatically setting or getting the position of a top-level window from the
+ client-side is typically not supported. Technically speaking, it depends on the shell
+ interface. For typical desktop compositors, however, the default shell interface will be
+ \c{XDG Shell}, which does not support manual positioning of windows. In such cases, Qt will
+ ignore calls to set the top-level position of a window, and, when queried, the window position
+ will always be returned as QPoint(0, 0).
*/
/*!
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 4bcc4565fa..9bb1b3016b 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -3415,6 +3415,10 @@ int QWidget::y() const
See the \l{Window Geometry} documentation for an overview of geometry
issues with windows.
+ \note Not all windowing systems support setting or querying top level window positions.
+ On such a system, programmatically moving windows may not have any effect, and artificial
+ values may be returned for the current positions, such as \c QPoint(0, 0).
+
\sa frameGeometry, size, x(), y()
*/
QPoint QWidget::pos() const