문제

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