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?

有帮助吗?

解决方案

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)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top