PySide6 QMainWindow move() not working on Ubuntu 22.04
-
The following example with PySide6 6.1.4 installed with PIP does not move the window to a fixed screen location on Ubuntu 22.04, but works on Windows 10:
# Example does not move window on Ubuntu 22.04 from PySide6.QtWidgets import QApplication, QMainWindow import sys app = QApplication(sys.argv) mainwindow = QMainWindow() mainwindow.show() # Move not working on Ubuntu 22.04, works on Windows 10: mainwindow.move(1000, 800) app.exec()
What could be the reason for a difference between Windows and Linux?
-
The code works fine on Ubuntu 22.04/KDE / X11. Are you using Wayland?
-
@friedemannkleint Thanks for your answer. Yes, I'm using:
- Ubuntu 22.04.1 LTS 64-bit (Running in VirtualBox)
- All updates installed.
- GNOME Version 42.5.
- Windowing System: Wayland.
The window opens in the upper left corner and not at position x=1000, y=800.
Do you have a suggestion how to analyze this?
-
@JonB I confirm the following with the test example in the first comment:
- Ubuntu on Wayland: Does not work
- Ubuntu X11: Works
- LXDE: Works
- Openbox: Works
- MATE 22.10: Works
- Xfce: Works
- XUbuntu: Works
- Windows 10: Works
Ubuntu Wayland is our default development platform and commonly used by our customers. Is there some special configuration needed for Wayland?
Jira bug report: PYSIDE-2190
-
@Erriez An unexpected answer in PYSIDE-2190:
This is a platform-specific issue of the underlying Qt library unrelated to the Python bindings for Qt which this project tracks. Please contact Qt support or report it under the QTBUG project along with a minimal C++ example ( see https://wiki.qt.io/Reporting_Bugs ).
The related issue QTBUG-86780 states that this is apparently not possible.
See my comment in PYSIDE-2190 which demonstrates a TKinter application which can move a window with a few lines of code on all platforms, including Ubuntu Wayland.
Conclusion:
- Moving the application window is not supported in Qt / PySide 6.4.1.
- Known issue QTBUG-86780, but still not documented in qtforpython-6.
- Confirmed in QTBUG-110119.
The reason why the quality of the Qt documentation is below our expectation is that the Qt developers confirmed this issue on Wayland and are ignoring the request to update the documentation.