mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
just set minimum size
This commit is contained in:
parent
92d1d09b14
commit
afb0b082fd
1 changed files with 5 additions and 11 deletions
|
|
@ -49,8 +49,6 @@ class ScrollMessageBox(QtWidgets.QDialog):
|
||||||
|
|
||||||
self.setWindowFlags(QtCore.Qt.WindowTitleHint)
|
self.setWindowFlags(QtCore.Qt.WindowTitleHint)
|
||||||
|
|
||||||
layout = QtWidgets.QVBoxLayout(self)
|
|
||||||
|
|
||||||
scroll_widget = QtWidgets.QScrollArea(self)
|
scroll_widget = QtWidgets.QScrollArea(self)
|
||||||
scroll_widget.setWidgetResizable(True)
|
scroll_widget.setWidgetResizable(True)
|
||||||
content_widget = QtWidgets.QWidget(self)
|
content_widget = QtWidgets.QWidget(self)
|
||||||
|
|
@ -63,14 +61,8 @@ class ScrollMessageBox(QtWidgets.QDialog):
|
||||||
content_layout.addWidget(label_widget)
|
content_layout.addWidget(label_widget)
|
||||||
message_len = max(message_len, len(message))
|
message_len = max(message_len, len(message))
|
||||||
|
|
||||||
# guess size of scrollable area
|
# Set minimum width
|
||||||
# WARNING: 'desktop' method probably won't work in PySide6
|
scroll_widget.setMinimumWidth(360)
|
||||||
desktop = QtWidgets.QApplication.desktop()
|
|
||||||
max_width = desktop.availableGeometry().width()
|
|
||||||
scroll_widget.setMinimumWidth(
|
|
||||||
min(max_width, message_len * 6)
|
|
||||||
)
|
|
||||||
layout.addWidget(scroll_widget)
|
|
||||||
|
|
||||||
buttons = QtWidgets.QDialogButtonBox.Ok
|
buttons = QtWidgets.QDialogButtonBox.Ok
|
||||||
if cancelable:
|
if cancelable:
|
||||||
|
|
@ -86,7 +78,9 @@ class ScrollMessageBox(QtWidgets.QDialog):
|
||||||
btn.clicked.connect(self._on_copy_click)
|
btn.clicked.connect(self._on_copy_click)
|
||||||
btn_box.addButton(btn, QtWidgets.QDialogButtonBox.NoRole)
|
btn_box.addButton(btn, QtWidgets.QDialogButtonBox.NoRole)
|
||||||
|
|
||||||
layout.addWidget(btn_box)
|
main_layout = QtWidgets.QVBoxLayout(self)
|
||||||
|
main_layout.addWidget(scroll_widget, 1)
|
||||||
|
main_layout.addWidget(btn_box, 0)
|
||||||
|
|
||||||
def _on_copy_click(self):
|
def _on_copy_click(self):
|
||||||
clipboard = QtWidgets.QApplication.clipboard()
|
clipboard = QtWidgets.QApplication.clipboard()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue