1
0
Fork 0
mirror of synced 2024-05-18 19:42:54 +12:00

Dialogs: Align contents on center when the WM doesn't respect the dialog size

Useful for `gamescope`'s `--force-windows-fullscreen` mode
This commit is contained in:
loathingKernel 2024-02-02 14:49:23 +02:00
parent 88b6e91530
commit 9eb5f2c51e

View file

@ -103,6 +103,7 @@ class ButtonDialog(BaseDialog):
self.main_layout.addItem(spacer)
self.main_layout.addLayout(self.button_layout)
self.main_layout.setSizeConstraint(QLayout.SetFixedSize)
self.main_layout.setAlignment(Qt.AlignVCenter)
def close(self):
raise RuntimeError(f"Don't use `close()` with {type(self).__name__}")
@ -117,6 +118,7 @@ class ButtonDialog(BaseDialog):
self.main_layout.indexOf(self.subtitle_label) + 1,
widget
)
widget.layout().setAlignment(Qt.AlignTop)
def setCentralLayout(self, layout: QLayout):
layout.setContentsMargins(0, 0, 0, 0)
@ -124,6 +126,7 @@ class ButtonDialog(BaseDialog):
self.main_layout.indexOf(self.subtitle_label) + 1,
layout
)
layout.setAlignment(Qt.AlignTop)
@abstractmethod
def accept_handler(self):