Skip to content

Commit a9acf01

Browse files
WrapperSettings: add no-wrapper label later to force container to resize
1 parent 5ce5318 commit a9acf01

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

rare/components/tabs/settings/widgets/wrappers.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self, parent=None):
5757
self.setCentralLayout(self.widget_layout)
5858

5959
self.accept_button.setText(self.tr("Save"))
60-
self.accept_button.setIcon(qta_icon("fa.edit"))
60+
self.accept_button.setIcon(qta_icon("fa.edit", "fa5s.edit"))
6161
self.accept_button.setEnabled(False)
6262

6363
self.result: Tuple = ()
@@ -135,7 +135,7 @@ def __init__(self, wrapper: Wrapper, parent=None):
135135
manage_menu.addActions([edit_action, delete_action])
136136

137137
manage_button = QPushButton(parent=self)
138-
manage_button.setIcon(qta_icon("mdi.menu", fallback="fa.align-justify"))
138+
manage_button.setIcon(qta_icon("mdi.menu", "fa5s.align-justify"))
139139
manage_button.setMenu(manage_menu)
140140
manage_button.setEnabled(wrapper.is_editable)
141141
if not wrapper.is_editable:
@@ -240,20 +240,21 @@ class WrapperSettings(QWidget):
240240
def __init__(self, parent=None):
241241
super(WrapperSettings, self).__init__(parent=parent)
242242

243-
self.wrapper_label = QLabel(self.tr("No wrappers defined"), self)
244-
self.wrapper_label.setFrameStyle(QLabel.Shape.StyledPanel | QLabel.Shadow.Plain)
245-
self.wrapper_label.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
246-
247243
self.add_button = QPushButton(self.tr("Add wrapper"), self)
248244
self.add_button.clicked.connect(self.__on_add)
249245

250246
self.wrapper_scroll = WrapperSettingsScroll(self)
251247
self.wrapper_scroll.setMinimumHeight(self.add_button.minimumSizeHint().height())
252248

253-
self.wrapper_container = WrapperContainer(self.wrapper_label, self.wrapper_scroll)
249+
self.wrapper_container = WrapperContainer(self.wrapper_scroll)
254250
self.wrapper_container.orderChanged.connect(self.__on_order_changed)
255251
self.wrapper_scroll.setWidget(self.wrapper_container)
256252

253+
self.wrapper_label = QLabel(self.tr("No wrappers defined"), self)
254+
self.wrapper_label.setFrameStyle(QLabel.Shape.StyledPanel | QLabel.Shadow.Plain)
255+
self.wrapper_label.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
256+
self.wrapper_container.main_layout.addWidget(self.wrapper_label)
257+
257258
# lk: set object names for the stylesheet
258259
self.setObjectName("WrapperSettings")
259260
self.wrapper_label.setObjectName(f"{self.objectName()}Label")
@@ -392,18 +393,17 @@ class WrapperContainer(QWidget):
392393
# QWidget: moving widget, int: new index
393394
orderChanged: Signal = Signal(QWidget, int)
394395

395-
def __init__(self, label: QLabel, parent=None):
396+
def __init__(self, parent=None):
396397
super(WrapperContainer, self).__init__(parent=parent)
397398
self.setAcceptDrops(True)
398399
self.__layout = QHBoxLayout()
399400
self.__drag_widget: Optional[QWidget] = None
400401

401-
main_layout = QHBoxLayout(self)
402-
main_layout.addWidget(label)
403-
main_layout.addLayout(self.__layout)
404-
main_layout.setContentsMargins(0, 0, 0, 0)
405-
main_layout.setAlignment(Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter)
406-
main_layout.setSizeConstraint(QHBoxLayout.SizeConstraint.SetFixedSize)
402+
self.main_layout = QHBoxLayout(self)
403+
self.main_layout.addLayout(self.__layout)
404+
self.main_layout.setContentsMargins(0, 0, 0, 0)
405+
self.main_layout.setAlignment(Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter)
406+
self.main_layout.setSizeConstraint(QHBoxLayout.SizeConstraint.SetFixedSize)
407407

408408
# lk: set object names for the stylesheet
409409
self.setObjectName(type(self).__name__)

0 commit comments

Comments
 (0)