style(lite): unify compact settings buttons

This commit is contained in:
RoyirinRosmontis
2026-09-18 22:29:28 +08:00
parent f4d777113c
commit e16ef58182
+13 -15
View File
@@ -999,6 +999,15 @@ class SettingsDialog(QDialog):
layout.addWidget(self.lb_hint) layout.addWidget(self.lb_hint)
layout.addSpacing(2) layout.addSpacing(2)
compact_button_style = f"""
QPushButton {{ background-color: {C_CARD}; color: {C_SUBTEXT}; border: 1px solid {C_BORDER};
border-radius: 5px; padding: 1px 7px; min-width: 34px; min-height: 18px;
font-size: 10px; }}
QPushButton:hover {{ background-color: #e3e8ee; color: {C_TEXT}; }}
QPushButton:checked {{ background-color: {C_TITLE}; color: #ffffff; border-color: {C_TITLE}; }}
QPushButton:disabled {{ background-color: #e7eaee; color: #a8afb8; border-color: #d8dde3; }}
"""
whitelist_row = QHBoxLayout() whitelist_row = QHBoxLayout()
whitelist_label = QLabel("域名路由") whitelist_label = QLabel("域名路由")
whitelist_label.setStyleSheet(f"color: {C_SUBTEXT}; font-size: 12px;") whitelist_label.setStyleSheet(f"color: {C_SUBTEXT}; font-size: 12px;")
@@ -1007,11 +1016,7 @@ class SettingsDialog(QDialog):
whitelist_row.addStretch() whitelist_row.addStretch()
self.btn_whitelist = QPushButton("配置") self.btn_whitelist = QPushButton("配置")
self.btn_whitelist.setCursor(Qt.PointingHandCursor) self.btn_whitelist.setCursor(Qt.PointingHandCursor)
self.btn_whitelist.setStyleSheet(f""" self.btn_whitelist.setStyleSheet(compact_button_style)
QPushButton {{ background-color: {C_CARD}; color: {C_SUBTEXT}; border: 1px solid {C_BORDER};
border-radius: 6px; padding: 2px 10px; font-size: 11px; }}
QPushButton:hover {{ background-color: #e3e8ee; color: {C_TEXT}; }}
""")
self.btn_whitelist.clicked.connect(self._open_whitelist) self.btn_whitelist.clicked.connect(self._open_whitelist)
whitelist_row.addWidget(self.btn_whitelist) whitelist_row.addWidget(self.btn_whitelist)
layout.addLayout(whitelist_row) layout.addLayout(whitelist_row)
@@ -1099,13 +1104,6 @@ class SettingsDialog(QDialog):
skip_row.addWidget(self.cb_skip_update) skip_row.addWidget(self.cb_skip_update)
layout.addLayout(skip_row) layout.addLayout(skip_row)
option_style = f"""
QPushButton {{ background-color: {C_CARD}; color: {C_SUBTEXT}; border: 1px solid {C_BORDER};
border-radius: 6px; padding: 2px 8px; font-size: 11px; min-width: 32px; }}
QPushButton:hover {{ background-color: #e3e8ee; color: {C_TEXT}; }}
QPushButton:checked {{ background-color: {C_TITLE}; color: #ffffff; border-color: {C_TITLE}; }}
"""
node_display_row = QHBoxLayout() node_display_row = QHBoxLayout()
node_display_label = QLabel("节点信息显示") node_display_label = QLabel("节点信息显示")
node_display_label.setStyleSheet(f"color: {C_SUBTEXT}; font-size: 12px;") node_display_label.setStyleSheet(f"color: {C_SUBTEXT}; font-size: 12px;")
@@ -1117,7 +1115,7 @@ class SettingsDialog(QDialog):
for button in (self.btn_node_domain, self.btn_node_remark): for button in (self.btn_node_domain, self.btn_node_remark):
button.setCheckable(True) button.setCheckable(True)
button.setCursor(Qt.PointingHandCursor) button.setCursor(Qt.PointingHandCursor)
button.setStyleSheet(option_style) button.setStyleSheet(compact_button_style)
node_display_row.addWidget(button) node_display_row.addWidget(button)
self.node_display_group = QButtonGroup(self) self.node_display_group = QButtonGroup(self)
self.node_display_group.setExclusive(True) self.node_display_group.setExclusive(True)
@@ -1140,7 +1138,7 @@ class SettingsDialog(QDialog):
for button in (self.btn_close_exit, self.btn_close_tray): for button in (self.btn_close_exit, self.btn_close_tray):
button.setCheckable(True) button.setCheckable(True)
button.setCursor(Qt.PointingHandCursor) button.setCursor(Qt.PointingHandCursor)
button.setStyleSheet(option_style) button.setStyleSheet(compact_button_style)
close_behavior_row.addWidget(button) close_behavior_row.addWidget(button)
self.close_behavior_group = QButtonGroup(self) self.close_behavior_group = QButtonGroup(self)
self.close_behavior_group.setExclusive(True) self.close_behavior_group.setExclusive(True)
@@ -1160,7 +1158,7 @@ class SettingsDialog(QDialog):
reset_row.addStretch() reset_row.addStretch()
self.btn_reset = QPushButton("重置") self.btn_reset = QPushButton("重置")
self.btn_reset.setCursor(Qt.PointingHandCursor) self.btn_reset.setCursor(Qt.PointingHandCursor)
self.btn_reset.setStyleSheet(option_style) self.btn_reset.setStyleSheet(compact_button_style)
self.btn_reset.setEnabled(not port_locked) self.btn_reset.setEnabled(not port_locked)
self.btn_reset.clicked.connect(self._reset_user_config) self.btn_reset.clicked.connect(self._reset_user_config)
reset_row.addWidget(self.btn_reset) reset_row.addWidget(self.btn_reset)