Python, Qt .move() function or .setGeometry()

Hi. Greetings to all.

I am using KDE on Fedora40. I am writing small programs with use of Python and PyQt5. In my old Fedora30 with old KDE with X11 was not a problem to open window at (x,y) by using Qt .move() function. Now I can’t. I found many information that case is happen because of Wayland. It developers left that possibility behind. Do you know some solution. Very odd but Tkinter has not that problem and also in Settings of KDE in “Windows rules” I can set ‘x’ an ‘y’ position of choosen window. How it is done?

Thanks for any help/answer
Radek Glebicki

I had a similar problem a while back with QML.

Move or drag did not work. Instead, I just changed the x and y values of the root object, similar to this. But this was all on an older system (and an older Qt version).

When you set stuff in window rules, you are essentially telling KWin directly, what to do (I haven’t read the code though). So, it’s not going to be a problem.

Yeah its a wayland thing.

Only the compositor is allowed to do absolute positioning, that’s why window rules work.

What are you trying to achieve? Why do you want to position your window, and not let the compositor handle it for you?

I am writing my own toolbar to place on left edge in the middle. Middle position depends on amount of icons. So ‘y’ is not always that same. :frowning: Now I am using ‘Windows rules’ but I have to correct that ‘y’.
Small and stupid problem but still problem.

obraz

Radek Glebicki

1 Like

Perhaps you can check out the code for the Panel and get some clues from that?

It seems to be able to do the centering thingy.

Please tell me what “Panel”. Some source in KDE?

Radek

I would expect it to be somewhere in either plasma-desktop or plasma-workspace.

I at least found the QML part to be in plasma-desktop/containments/panel/, so perhaps you can start looking from there.

I am unable to be of much more use rn, but you might be able to find what you want if you look for how the floating, centered panel is implemented.

1 Like