PyQt6 code runs great on Win/Mac but not KDE

Hi there!

I use Arch Linux with KDE Plasma ( Wayland ) and this PyQt6 code runs great on Windows / MacOS. ( See: github repository of the user “Khufos” with the title " Pyqt6 Title hide and window move" ).

It even runs well on Linux with XFCE but unfortunately not with KDE.
What could be the issue?

You should really put up a project link so that people know what you are talking about

Since @pneumus might not be able to post a link (new user).

Here’s the actual project if that can help: GitHub - Khufos/Pyqt6-Title-hide-and-window-move: frameless position pyqt6

1 Like

What does “run well” mean here exactly?

It behaves as expected. I can drag the window with the cursor.

Thanks for understanding :pray:
I was blocked and could not paste the URL.

Seems like nobody can resolve this.
I consider this as a BUG.

Probably because of Wayland. Windows can not set their own position on Wayland. You have to tell the compositor to move the window with the cursor.

On PySide6 this code works:

import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.setWindowTitle("My App")

        button = QPushButton("Press Me!")
        button.setCheckable(True)
        button.pressed.connect(self.the_button_was_clicked)

        self.setCentralWidget(button)

    def the_button_was_clicked(self):
        self.windowHandle().startSystemMove()

app = QApplication(sys.argv)

window = MainWindow()
window.show()

app.exec()

Here’s the Qt documentation on QWindow::startSystemMove() QWindow Class | Qt GUI 6.8.1