[view] improvement: allowing max_width to be defined for the confirmation dialogs

This commit is contained in:
Vinicius Moreira
2022-03-30 17:14:46 -03:00
parent 889a30e2e8
commit 45c586ed4b
4 changed files with 12 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ class ConfirmationDialog(QDialog):
widgets: Optional[List[QWidget]] = None, confirmation_button: bool = True, deny_button: bool = True,
window_cancel: bool = False, confirmation_label: Optional[str] = None, deny_label: Optional[str] = None,
confirmation_icon: bool = True, min_width: Optional[int] = None,
min_height: Optional[int] = None):
min_height: Optional[int] = None, max_width: Optional[int] = None):
super(ConfirmationDialog, self).__init__()
if not window_cancel:
@@ -46,6 +46,9 @@ class ConfirmationDialog(QDialog):
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred)
self.setMinimumWidth(min_width if min_width and min_width > 0 else 250)
if max_width is not None and max_width > 0:
self.setMaximumWidth(max_width)
if isinstance(min_height, int) and min_height > 0:
self.setMinimumHeight(min_height)