refactor/pure-qt-ui #3
|
|
@ -20,6 +20,10 @@
|
||||||
#include "AuthService.hpp"
|
#include "AuthService.hpp"
|
||||||
#include "Theme.hpp"
|
#include "Theme.hpp"
|
||||||
|
|
||||||
|
#include <ElaCheckBox.h>
|
||||||
|
#include <ElaLineEdit.h>
|
||||||
|
#include <ElaPushButton.h>
|
||||||
|
|
||||||
namespace geopro::app {
|
namespace geopro::app {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
@ -95,12 +99,7 @@ LoginWindow::LoginWindow(geopro::net::AuthService& auth, QWidget* parent)
|
||||||
"#brandTitle { color: #FFFFFF; font-size: %1px; font-weight: %2; }"
|
"#brandTitle { color: #FFFFFF; font-size: %1px; font-weight: %2; }"
|
||||||
"#brandSubtitle { color: rgba(255,255,255,0.82); font-size: %3px; }"
|
"#brandSubtitle { color: rgba(255,255,255,0.82); font-size: %3px; }"
|
||||||
"#fieldLabel { color: #5A6B85; font-size: %4px; font-weight: %5; }"
|
"#fieldLabel { color: #5A6B85; font-size: %4px; font-weight: %5; }"
|
||||||
"QLineEdit {"
|
// 输入框已 Ela 化(ElaLineEdit 自绘 Fluent + 自动明暗),不再写 QLineEdit QSS。
|
||||||
" background: #FFFFFF; color: #1F2A3D;"
|
|
||||||
" border: 1px solid #C7D2E0; border-radius: 8px; padding: 0 12px;"
|
|
||||||
" selection-background-color: #2D6CB5; selection-color: #FFFFFF; }"
|
|
||||||
"QLineEdit:focus { border: 1px solid #2D6CB5; }"
|
|
||||||
"QLineEdit:disabled { background: #F0F2F6; color: #8A93A3; }"
|
|
||||||
"#captchaImg { border: 1px solid #C7D2E0; border-radius: 8px; background: #EEF2FB; }")
|
"#captchaImg { border: 1px solid #C7D2E0; border-radius: 8px; background: #EEF2FB; }")
|
||||||
.arg(type::kDisplay)
|
.arg(type::kDisplay)
|
||||||
.arg(type::kWeightBold)
|
.arg(type::kWeightBold)
|
||||||
|
|
@ -146,12 +145,12 @@ LoginWindow::LoginWindow(geopro::net::AuthService& auth, QWidget* parent)
|
||||||
form->addSpacing(6);
|
form->addSpacing(6);
|
||||||
};
|
};
|
||||||
|
|
||||||
userEdit_ = new QLineEdit(body);
|
userEdit_ = new ElaLineEdit(body);
|
||||||
userEdit_->setPlaceholderText(QStringLiteral("请输入用户名"));
|
userEdit_->setPlaceholderText(QStringLiteral("请输入用户名"));
|
||||||
userEdit_->setClearButtonEnabled(true);
|
userEdit_->setClearButtonEnabled(true);
|
||||||
addField(QStringLiteral("用户名"), userEdit_);
|
addField(QStringLiteral("用户名"), userEdit_);
|
||||||
|
|
||||||
pwdEdit_ = new QLineEdit(body);
|
pwdEdit_ = new ElaLineEdit(body);
|
||||||
pwdEdit_->setEchoMode(QLineEdit::Password);
|
pwdEdit_->setEchoMode(QLineEdit::Password);
|
||||||
pwdEdit_->setPlaceholderText(QStringLiteral("请输入密码"));
|
pwdEdit_->setPlaceholderText(QStringLiteral("请输入密码"));
|
||||||
addField(QStringLiteral("密码"), pwdEdit_);
|
addField(QStringLiteral("密码"), pwdEdit_);
|
||||||
|
|
@ -163,7 +162,7 @@ LoginWindow::LoginWindow(geopro::net::AuthService& auth, QWidget* parent)
|
||||||
|
|
||||||
auto* captchaRow = new QHBoxLayout();
|
auto* captchaRow = new QHBoxLayout();
|
||||||
captchaRow->setSpacing(10);
|
captchaRow->setSpacing(10);
|
||||||
codeEdit_ = new QLineEdit(body);
|
codeEdit_ = new ElaLineEdit(body);
|
||||||
codeEdit_->setMinimumHeight(40);
|
codeEdit_->setMinimumHeight(40);
|
||||||
codeEdit_->setPlaceholderText(QStringLiteral("请输入验证码"));
|
codeEdit_->setPlaceholderText(QStringLiteral("请输入验证码"));
|
||||||
captchaLabel_ = new QLabel(body);
|
captchaLabel_ = new QLabel(body);
|
||||||
|
|
@ -187,10 +186,8 @@ LoginWindow::LoginWindow(geopro::net::AuthService& auth, QWidget* parent)
|
||||||
form->addLayout(refreshRow);
|
form->addLayout(refreshRow);
|
||||||
|
|
||||||
// 记住登录:勾选后成功登录将安全存储 token,30 天内免登录。默认不勾(更安全)。
|
// 记住登录:勾选后成功登录将安全存储 token,30 天内免登录。默认不勾(更安全)。
|
||||||
rememberChk_ = new QCheckBox(QStringLiteral("记住登录(30 天内免登录)"), body);
|
rememberChk_ = new ElaCheckBox(QStringLiteral("记住登录(30 天内免登录)"), body);
|
||||||
rememberChk_->setCursor(Qt::PointingHandCursor);
|
rememberChk_->setCursor(Qt::PointingHandCursor); // ElaCheckBox 自绘 Fluent + 自动明暗
|
||||||
rememberChk_->setStyleSheet(
|
|
||||||
QStringLiteral("color:#5A6B85; font-size:%1px;").arg(type::kBody));
|
|
||||||
form->addWidget(rememberChk_);
|
form->addWidget(rememberChk_);
|
||||||
|
|
||||||
// 错误提示:固定占位高度,避免出现时整体布局跳动。
|
// 错误提示:固定占位高度,避免出现时整体布局跳动。
|
||||||
|
|
@ -204,17 +201,9 @@ LoginWindow::LoginWindow(geopro::net::AuthService& auth, QWidget* parent)
|
||||||
form->addStretch();
|
form->addStretch();
|
||||||
|
|
||||||
// 主操作:满宽强调主按钮(von Restorff:唯一高强调元素引导主流程)。
|
// 主操作:满宽强调主按钮(von Restorff:唯一高强调元素引导主流程)。
|
||||||
loginBtn_ = new QPushButton(QStringLiteral("登 录"), body);
|
loginBtn_ = new ElaPushButton(QStringLiteral("登 录"), body); // Fluent 主按钮(自动明暗)
|
||||||
loginBtn_->setMinimumHeight(44);
|
loginBtn_->setMinimumHeight(44);
|
||||||
loginBtn_->setCursor(Qt::PointingHandCursor);
|
loginBtn_->setCursor(Qt::PointingHandCursor);
|
||||||
loginBtn_->setStyleSheet(QStringLiteral(
|
|
||||||
"QPushButton { background: #2D6CB5; color: #FFFFFF; border: none; border-radius: 8px; "
|
|
||||||
"font-size: %1px; font-weight: %2; }"
|
|
||||||
"QPushButton:hover { background: #2862A6; }"
|
|
||||||
"QPushButton:pressed { background: #234F87; }"
|
|
||||||
"QPushButton:disabled { background: #9FB4CC; }")
|
|
||||||
.arg(type::kTitle)
|
|
||||||
.arg(type::kWeightSemibold));
|
|
||||||
loginBtn_->setDefault(true);
|
loginBtn_->setDefault(true);
|
||||||
form->addWidget(loginBtn_);
|
form->addWidget(loginBtn_);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -966,7 +966,11 @@ int main(int argc, char* argv[])
|
||||||
QCoreApplication::setOrganizationName(QStringLiteral("Geomative"));
|
QCoreApplication::setOrganizationName(QStringLiteral("Geomative"));
|
||||||
QCoreApplication::setApplicationName(QStringLiteral("Geopro3"));
|
QCoreApplication::setApplicationName(QStringLiteral("Geopro3"));
|
||||||
|
|
||||||
// 浅色专业主题(Fusion + 调色板 + 全局样式表):仅外观,登录窗与工作台共用。
|
// ElaApplication:Fluent 主题/字体/动画基建。无条件初始化——登录窗与各面板已 Ela 化,
|
||||||
|
// 两种壳都需要它(登录发生在选壳之前)。Ela 控件跟随 ElaTheme;标准控件仍由下面 QSS 接管。
|
||||||
|
eApp->init();
|
||||||
|
|
||||||
|
// 专业主题(Fusion + 调色板 + 全局样式表):标准控件外观,登录窗与工作台共用。
|
||||||
geopro::app::applyTheme(app);
|
geopro::app::applyTheme(app);
|
||||||
|
|
||||||
// PROJ 数据(proj.db)定位:体素配准的 CrsTransform 需要。优先已设环境变量;
|
// PROJ 数据(proj.db)定位:体素配准的 CrsTransform 需要。优先已设环境变量;
|
||||||
|
|
@ -1022,7 +1026,6 @@ int main(int argc, char* argv[])
|
||||||
const QString kTitle = QStringLiteral("Geopro 3.0 — 项目分析视图 (M1)");
|
const QString kTitle = QStringLiteral("Geopro 3.0 — 项目分析视图 (M1)");
|
||||||
QWidget* topLevel = nullptr;
|
QWidget* topLevel = nullptr;
|
||||||
if (qEnvironmentVariable("GEOPRO_UI_SHELL") == QLatin1String("ela")) {
|
if (qEnvironmentVariable("GEOPRO_UI_SHELL") == QLatin1String("ela")) {
|
||||||
eApp->init(); // ElaApplication:Fluent 主题/字体/动画基建
|
|
||||||
auto* ela = new ElaWindow;
|
auto* ela = new ElaWindow;
|
||||||
ela->setWindowTitle(kTitle);
|
ela->setWindowTitle(kTitle);
|
||||||
ela->resize(1280, 800);
|
ela->resize(1280, 800);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue