moninj: TTL widgets horizontal layout

This commit is contained in:
Simon Renblad 2024-04-17 10:55:35 +08:00
parent 88ec806879
commit 2d8a3d14a6

View File

@ -36,18 +36,15 @@ class _TTLWidget(QtWidgets.QFrame):
self.setFrameShadow(QtWidgets.QFrame.Raised)
grid = QtWidgets.QGridLayout()
grid.setContentsMargins(0, 0, 0, 0)
grid.setHorizontalSpacing(0)
grid.setContentsMargins(2, 2, 2, 2)
grid.setHorizontalSpacing(2)
grid.setVerticalSpacing(0)
self.setLayout(grid)
label = QtWidgets.QLabel(title)
label.setAlignment(QtCore.Qt.AlignCenter)
label.setSizePolicy(QtWidgets.QSizePolicy.Ignored,
QtWidgets.QSizePolicy.Preferred)
grid.addWidget(label, 1, 1)
grid.addWidget(label, 0, 0)
self.stack = QtWidgets.QStackedWidget()
grid.addWidget(self.stack, 2, 1)
grid.addWidget(self.stack, 0, 1)
self.direction = QtWidgets.QLabel()
self.direction.setAlignment(QtCore.Qt.AlignCenter)
@ -61,22 +58,21 @@ class _TTLWidget(QtWidgets.QFrame):
self.override.setText("OVR")
self.override.setCheckable(True)
self.override.setToolTip("Override")
grid_cb.addWidget(self.override, 3, 1)
grid_cb.addWidget(self.override, 0, 0)
self.level = QtWidgets.QToolButton()
self.level.setText("LVL")
self.level.setCheckable(True)
self.level.setToolTip("Level")
grid_cb.addWidget(self.level, 3, 2)
grid_cb.addWidget(self.level, 0, 1)
self.stack.addWidget(grid_cb)
self.value = QtWidgets.QLabel()
self.value.setAlignment(QtCore.Qt.AlignCenter)
grid.addWidget(self.value, 3, 1)
self.value.setAlignment(QtCore.Qt.AlignRight)
grid.addWidget(self.value, 0, 2)
grid.setRowStretch(1, 1)
grid.setRowStretch(2, 0)
grid.setRowStretch(3, 0)
grid.setRowStretch(4, 1)
grid.setColumnStretch(0, 1)
grid.setColumnStretch(1, 1)
grid.setColumnStretch(2, 1)
self.override.clicked.connect(self.override_toggled)
self.level.clicked.connect(self.level_toggled)