def __init__(self, parent=None): super().__init__(parent) self.setIcon(QMessageBox.Question) self.setWindowTitle(QApplication.applicationName()) self.setWindowModality(Qt.WindowModal) if platformSpecific.showAppIconInDialog(): iconSize = self.style().pixelMetric(QStyle.PM_MessageBoxIconSize, None, self) icon = self.windowIcon() size = icon.actualSize(QSize(iconSize, iconSize)) self.setIconPixmap(icon.pixmap(size))
def __init__(self, parent=None): super().__init__(parent) # TODO: make sure we need this on Windows self.setWindowTitle(QApplication.applicationName()) self.setText(self.tr("Do you want to save your changes?")) self.setInformativeText(self.tr("Your changes will be lost if you don’t save them.")) self.setWindowModality(Qt.WindowModal) self.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel) self.setDefaultButton(QMessageBox.Save) self.setIcon(QMessageBox.Question) if platformSpecific.showAppIconInDialog(): iconSize = self.style().pixelMetric(QStyle.PM_MessageBoxIconSize, None, self) icon = self.windowIcon() size = icon.actualSize(QSize(iconSize, iconSize)) self.setIconPixmap(icon.pixmap(size))