centerWidgetInScreen now centers the widget on the screen containing its parent widget.

This commit is contained in:
David Vierra 2015-09-17 20:40:02 -10:00
parent abcc812e80
commit e11787a4fa

View File

@ -17,7 +17,13 @@ def centerWidgetInScreen(widget, resize=None):
:return:
:rtype:
"""
screen = QtGui.QApplication.desktop().availableGeometry()
desktop = QtGui.QApplication.desktop()
parent = widget.parent()
if parent is not None:
screenNo = desktop.screenNumber(parent)
else:
screenNo = -1
screen = desktop.availableGeometry(screenNo)
w = screen.width()
h = screen.height()
r = widget.geometry()