Prevent dialog from moving label/bar widgets on resize when nested
This commit is contained in:
parent
e6507f8601
commit
7c1a6ecb1a
@ -13,11 +13,11 @@ app = QtGui.QApplication([])
|
||||
|
||||
|
||||
def runStage(i):
|
||||
"""Waste time for 3 seconds while incrementing a progress bar.
|
||||
"""Waste time for 2 seconds while incrementing a progress bar.
|
||||
"""
|
||||
with pg.ProgressDialog("Running stage %s.." % i, maximum=100, nested=True) as dlg:
|
||||
for j in range(100):
|
||||
time.sleep(0.03)
|
||||
time.sleep(0.02)
|
||||
dlg += 1
|
||||
if dlg.wasCanceled():
|
||||
print("Canceled stage %s" % i)
|
||||
|
@ -183,6 +183,12 @@ class ProgressDialog(QtGui.QProgressDialog):
|
||||
self._nestableWidgets = (sw, btn)
|
||||
|
||||
return self._nestableWidgets
|
||||
|
||||
def resizeEvent(self, ev):
|
||||
if self._nestingReady:
|
||||
# don't let progress dialog manage widgets anymore.
|
||||
return
|
||||
return QtGui.QProgressDialog.resizeEvent(self, ev)
|
||||
|
||||
## wrap all other functions to make sure they aren't being called from non-gui threads
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user