修复:

- 登录弹窗布局重排:左侧 logo,右侧登录名/密码输入框,底部小字提示"登录以获取节点配置"+ 取消/登录按钮
This commit is contained in:
RoyirinRosmontis
2026-08-23 13:20:32 +08:00
parent 61a59a7872
commit 2ab7b90c49
+27 -24
View File
@@ -1123,7 +1123,7 @@ class LoginDialog(QDialog):
super().__init__(parent)
self.setWindowTitle("节点配置登录")
self.setWindowIcon(load_icon())
self.setFixedSize(300, 232)
self.setFixedSize(340, 190)
self.setStyleSheet(f"""
QDialog {{ background-color: {C_BG}; }}
QLabel {{ color: {C_TEXT}; font-family: "Microsoft YaHei", "Segoe UI", sans-serif; font-size: 12px; }}
@@ -1149,47 +1149,50 @@ class LoginDialog(QDialog):
}}
""")
layout = QVBoxLayout(self)
layout.setSpacing(10)
layout.setContentsMargins(20, 16, 20, 16)
root = QHBoxLayout(self)
root.setSpacing(14)
root.setContentsMargins(20, 18, 20, 16)
title = QLabel("节点配置登录")
title.setStyleSheet(f"color: {C_TITLE}; font-size: 15px; font-weight: bold;")
title.setAlignment(Qt.AlignCenter)
layout.addWidget(title)
hint = QLabel("登录后自动获取节点配置")
hint.setStyleSheet(f"color: {C_SUBTEXT}; font-size: 11px;")
hint.setAlignment(Qt.AlignCenter)
layout.addWidget(hint)
# 左侧 logo
logo = QLabel()
logo.setPixmap(load_icon().pixmap(48, 48))
logo.setFixedSize(48, 48)
logo.setAlignment(Qt.AlignCenter)
root.addWidget(logo, 0, Qt.AlignVCenter)
# 右侧表单
form = QVBoxLayout()
form.setSpacing(8)
self.ed_user = QLineEdit()
self.ed_user.setPlaceholderText("用户名")
layout.addWidget(self.ed_user)
self.ed_user.setPlaceholderText("登录名")
form.addWidget(self.ed_user)
self.ed_pass = QLineEdit()
self.ed_pass.setPlaceholderText("密码")
self.ed_pass.setEchoMode(QLineEdit.Password)
self.ed_pass.returnPressed.connect(self._submit)
layout.addWidget(self.ed_pass)
form.addWidget(self.ed_pass)
self.lb_err = QLabel("")
self.lb_err.setStyleSheet(f"color: {C_RED}; font-size: 11px;")
self.lb_err.setAlignment(Qt.AlignCenter)
layout.addWidget(self.lb_err)
form.addWidget(self.lb_err)
btns = QHBoxLayout()
btns.addStretch()
bottom = QHBoxLayout()
bottom.setSpacing(10)
hint = QLabel("登录以获取节点配置")
hint.setStyleSheet(f"color: {C_SUBTEXT}; font-size: 10px;")
bottom.addWidget(hint)
bottom.addStretch()
self.btn_cancel = QPushButton("取消")
self.btn_cancel.setObjectName("btnCancel")
self.btn_cancel.clicked.connect(self.reject)
btns.addWidget(self.btn_cancel)
bottom.addWidget(self.btn_cancel)
self.btn_ok = QPushButton("登录")
self.btn_ok.setObjectName("btnOk")
self.btn_ok.clicked.connect(self._submit)
btns.addWidget(self.btn_ok)
btns.addStretch()
layout.addLayout(btns)
bottom.addWidget(self.btn_ok)
form.addLayout(bottom)
root.addLayout(form, 1)
self._done.connect(self._on_done)