Does QMainWindow.move()
bound the position of the mainwindow to the screen?
I'm working on a PyQt5 application that places an unframed window somewhere in the screen, close to the system tray icon that triggers the window's show event.
The logic in the code is not very clever but seems to do the trick:
systray_icon_pos = self.status_icon.geometry().center()
self.move(systray_icon_pos.x() - self.width() / 2,
systray_icon_pos.y())
A user complains that the window appears off screen, while on my desktop, it won't exceed screen boundaries, even if I patch that code to hardcode huge numbers as move
parameters. I thought it could be because we're using different desktop environments (I use Mate, he uses Gnome), but while testing, I did observe the behaviour he describes. I just can't reproduce it.
Also, some people on the Internet use move(-50000, -50000)
to hide a window temporarily by putting it off-screen (here's an example).
I don't find any explicit mention of this in the docs.