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:
parent
88b6e91530
commit
9eb5f2c51e
|
@ -103,6 +103,7 @@ class ButtonDialog(BaseDialog):
|
||||||
self.main_layout.addItem(spacer)
|
self.main_layout.addItem(spacer)
|
||||||
self.main_layout.addLayout(self.button_layout)
|
self.main_layout.addLayout(self.button_layout)
|
||||||
self.main_layout.setSizeConstraint(QLayout.SetFixedSize)
|
self.main_layout.setSizeConstraint(QLayout.SetFixedSize)
|
||||||
|
self.main_layout.setAlignment(Qt.AlignVCenter)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
raise RuntimeError(f"Don't use `close()` with {type(self).__name__}")
|
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,
|
self.main_layout.indexOf(self.subtitle_label) + 1,
|
||||||
widget
|
widget
|
||||||
)
|
)
|
||||||
|
widget.layout().setAlignment(Qt.AlignTop)
|
||||||
|
|
||||||
def setCentralLayout(self, layout: QLayout):
|
def setCentralLayout(self, layout: QLayout):
|
||||||
layout.setContentsMargins(0, 0, 0, 0)
|
layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
@ -124,6 +126,7 @@ class ButtonDialog(BaseDialog):
|
||||||
self.main_layout.indexOf(self.subtitle_label) + 1,
|
self.main_layout.indexOf(self.subtitle_label) + 1,
|
||||||
layout
|
layout
|
||||||
)
|
)
|
||||||
|
layout.setAlignment(Qt.AlignTop)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def accept_handler(self):
|
def accept_handler(self):
|
||||||
|
|
Loading…
Reference in a new issue