centerWidgetInScreen now centers the widget on the screen containing its parent widget.
This commit is contained in:
parent
abcc812e80
commit
e11787a4fa
@ -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()
|
||||
|
Reference in New Issue
Block a user