Question

I have a main widow. I move it to an bottom edge or corner. Then I open a dialog by click some button in it. The dialog is positioned at the center of the main window since I set the main window as its parent. However, the dialog is not displayed on the screen because the main window is at the edge or corner. How to make it displayed on screen?

Was it helpful?

Solution

You can move it with negative coordinates until it becomes on screen:

dialog.move(-dialog.width(), -dialog.height())

This should move it so it's bottom right edge aligns with main windows's top left edge.

Or you could make the dialog parentless and move it in relation to screen coordinates instead:

dialog.setParent(None)
dialog.move(400, 300)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top