修复:

- 登录弹窗布局重排:左侧 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) super().__init__(parent)
self.setWindowTitle("节点配置登录") self.setWindowTitle("节点配置登录")
self.setWindowIcon(load_icon()) self.setWindowIcon(load_icon())
self.setFixedSize(300, 232) self.setFixedSize(340, 190)
self.setStyleSheet(f""" self.setStyleSheet(f"""
QDialog {{ background-color: {C_BG}; }} QDialog {{ background-color: {C_BG}; }}
QLabel {{ color: {C_TEXT}; font-family: "Microsoft YaHei", "Segoe UI", sans-serif; font-size: 12px; }} 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) root = QHBoxLayout(self)
layout.setSpacing(10) root.setSpacing(14)
layout.setContentsMargins(20, 16, 20, 16) root.setContentsMargins(20, 18, 20, 16)
title = QLabel("节点配置登录") # 左侧 logo
title.setStyleSheet(f"color: {C_TITLE}; font-size: 15px; font-weight: bold;") logo = QLabel()
title.setAlignment(Qt.AlignCenter) logo.setPixmap(load_icon().pixmap(48, 48))
layout.addWidget(title) logo.setFixedSize(48, 48)
logo.setAlignment(Qt.AlignCenter)
hint = QLabel("登录后自动获取节点配置") root.addWidget(logo, 0, Qt.AlignVCenter)
hint.setStyleSheet(f"color: {C_SUBTEXT}; font-size: 11px;")
hint.setAlignment(Qt.AlignCenter)
layout.addWidget(hint)
# 右侧表单
form = QVBoxLayout()
form.setSpacing(8)
self.ed_user = QLineEdit() self.ed_user = QLineEdit()
self.ed_user.setPlaceholderText("用户名") self.ed_user.setPlaceholderText("登录名")
layout.addWidget(self.ed_user) form.addWidget(self.ed_user)
self.ed_pass = QLineEdit() self.ed_pass = QLineEdit()
self.ed_pass.setPlaceholderText("密码") self.ed_pass.setPlaceholderText("密码")
self.ed_pass.setEchoMode(QLineEdit.Password) self.ed_pass.setEchoMode(QLineEdit.Password)
self.ed_pass.returnPressed.connect(self._submit) self.ed_pass.returnPressed.connect(self._submit)
layout.addWidget(self.ed_pass) form.addWidget(self.ed_pass)
self.lb_err = QLabel("") self.lb_err = QLabel("")
self.lb_err.setStyleSheet(f"color: {C_RED}; font-size: 11px;") self.lb_err.setStyleSheet(f"color: {C_RED}; font-size: 11px;")
self.lb_err.setAlignment(Qt.AlignCenter) form.addWidget(self.lb_err)
layout.addWidget(self.lb_err)
btns = QHBoxLayout() bottom = QHBoxLayout()
btns.addStretch() 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 = QPushButton("取消")
self.btn_cancel.setObjectName("btnCancel") self.btn_cancel.setObjectName("btnCancel")
self.btn_cancel.clicked.connect(self.reject) self.btn_cancel.clicked.connect(self.reject)
btns.addWidget(self.btn_cancel) bottom.addWidget(self.btn_cancel)
self.btn_ok = QPushButton("登录") self.btn_ok = QPushButton("登录")
self.btn_ok.setObjectName("btnOk") self.btn_ok.setObjectName("btnOk")
self.btn_ok.clicked.connect(self._submit) self.btn_ok.clicked.connect(self._submit)
btns.addWidget(self.btn_ok) bottom.addWidget(self.btn_ok)
btns.addStretch() form.addLayout(bottom)
layout.addLayout(btns) root.addLayout(form, 1)
self._done.connect(self._on_done) self._done.connect(self._on_done)