python - PySide: hiding a dialog breaks the dialog.exec_() -
in project have show people dialog can accept or open dialog. start dialog usage of dialog.exec_()
should make possible catch qtgui.qdialog.accepted
, nice things after it.
while first dialog opens second dialog try hide first dialog self.hide()
, show again self.show()
when second dialog receives qtgui.qdialog.accepted
. works fine, after accept button of first window not return qtgui.qdialog.accepted
the thing works fine until usage of self.hide()
, self.show()
while opening second window. leaving hiding option out makes work without flaws.
how can hide , show dialog without breaking dialog.exec_()
need know when window gets accepted?
abarnert's answer made me think again dialog designs. first tried again non-modal dialogs, not consistent.
finally made sequence of modal dialogs works great! first start first dialog, when accepted continues, when rejected dialog comes can accepted. after accept second dialog first dialog executed again.
by using while loop can manage this:
self.notification = firstdialog(self) #custom dialog class self.notification2 = seconddialog(self) #second custom dialog class while true: self.notification.show() if self.notification.exec_() == qtgui.qdialog.accepted: break else: #in case of rejection (the other option in dialog) self.notification2.show() if self.notification2.exec_() == qtgui.qdialog.accepted: continue self.startfunction() #start should happen after people accept dialog
Comments
Post a Comment