MCPcopy Create free account
hub / github.com/Hashiao/wuwaBackendTool / WelcomeDialog

Method WelcomeDialog

welcomedialog.cpp:6–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <QMessageBox>
5
6WelcomeDialog::WelcomeDialog(QWidget *parent) :
7 QDialog(parent),
8 ui(new Ui::WelcomeDialog)
9{
10 ui->setupUi(this);
11 countdownValue = Utils::WELCOME_SEC;
12
13 // 禁用关闭功能和按钮
14 setWindowFlags(windowFlags() & ~Qt::WindowCloseButtonHint);
15 ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
16 ui->buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false);
17
18 // 设置初始文本
19 ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK (%1)").arg(countdownValue));
20
21 // 创建并启动倒计时
22 countdownTimer = new QTimer(this);
23 connect(countdownTimer, &QTimer::timeout, this, &WelcomeDialog::updateCountdown);
24 countdownTimer->start(1000); // 每秒触发一次
25
26 // 禁用所有关闭操作
27 setWindowFlag(Qt::WindowCloseButtonHint, false);
28
29 // 连接 OK 和 Cancel 按钮槽函数
30 connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
31 connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
32}
33
34WelcomeDialog::~WelcomeDialog()
35{

Callers

nothing calls this directly

Calls 1

startMethod · 0.80

Tested by

no test coverage detected