Files
QT_wuhan_YT/pages/passwordmgmtpage.cpp
T
2026-09-09 17:00:37 +08:00

58 lines
2.1 KiB
C++

#include "passwordmgmtpage.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QCheckBox>
#include "global.h"
PasswordMgmtPage::PasswordMgmtPage(AppContext* ctx, QWidget* parent)
: BasePage(ctx, parent)
{
QVBoxLayout* root = new QVBoxLayout(this);
root->addStretch(1);
QWidget* col = new QWidget(this);
col->setFixedWidth(700);
QVBoxLayout* lay = new QVBoxLayout(col);
lay->setSpacing(24);
lay->setAlignment(Qt::AlignHCenter);
QLabel* title = label("密码管理界面", 28, C::TEXT, true, col);
title->setAlignment(Qt::AlignCenter);
lay->addWidget(title);
// 功能选项列表
QWidget* option = new QWidget(col);
option->setProperty("card", true);
option->setStyleSheet(QString("QWidget[card=\"true\"]{background-color:%1;border:2px solid %2;border-radius:12px;}")
.arg(C::PANEL, C::BORDER));
QVBoxLayout* optLay = new QVBoxLayout(option);
m_reset = new QCheckBox("重置密码功能", option);
m_reset->setChecked(true);
m_reset->setStyleSheet(QString(
"QCheckBox{color:%1;font-size:26px;spacing:12px;}"
"QCheckBox::indicator{width:32px;height:32px;border:2px solid %2;border-radius:6px;background-color:%3;}"
"QCheckBox::indicator:checked{background-color:%4;border-color:%4;image:none;}")
.arg(C::TEXT, C::BORDER, C::BG, C::PRIMARY));
optLay->addWidget(m_reset);
lay->addWidget(option);
// 确认 / 退出
QHBoxLayout* btnRow = new QHBoxLayout();
btnRow->addStretch(1);
QPushButton* ok = button("确认", "primary", col);
ok->setFixedSize(180, 72);
connect(ok, &QPushButton::clicked, this, [this]() { emit navigate(PageReset); });
QPushButton* exit = button("退出", "", col);
exit->setFixedSize(180, 72);
connect(exit, &QPushButton::clicked, this, [this]() { emit navigate(PageBoot); });
btnRow->addWidget(ok);
btnRow->addWidget(exit);
btnRow->addStretch(1);
lay->addLayout(btnRow);
root->addWidget(col, 0, Qt::AlignHCenter);
root->addStretch(1);
}