Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Work Files: Fix parenting of save prompt QMessageBox #2784

Merged
merged 2 commits into from
Feb 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions openpype/tools/workfiles/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,9 @@ def open_file(self, filepath):
self.file_opened.emit()

def save_changes_prompt(self):
self._messagebox = messagebox = QtWidgets.QMessageBox()

messagebox.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self._messagebox = messagebox = QtWidgets.QMessageBox(parent=self)
messagebox.setWindowFlags(messagebox.windowFlags() |
QtCore.Qt.FramelessWindowHint)
messagebox.setIcon(messagebox.Warning)
messagebox.setWindowTitle("Unsaved Changes!")
messagebox.setText(
Expand All @@ -739,10 +739,6 @@ def save_changes_prompt(self):
messagebox.Yes | messagebox.No | messagebox.Cancel
)

# Parenting the QMessageBox to the Widget seems to crash
# so we skip parenting and explicitly apply the stylesheet.
messagebox.setStyle(self.style())

result = messagebox.exec_()
if result == messagebox.Yes:
return True
Expand Down