#include "nmSwitchOutlineConfirmationDlg.h" #include #include #include #include nmSwitchOutlineConfirmationDlg::nmSwitchOutlineConfirmationDlg() { this->initUI(); this->resize(250,80); } void nmSwitchOutlineConfirmationDlg::initUI() { // 设置对话框的窗口标题 this->setWindowTitle(tr("confirm")); // 创建布局和控件 QVBoxLayout *mainLayout = new QVBoxLayout(this); QLabel *messageLabel = new QLabel(tr("Are you sure you want to switch outline?"), this); mainLayout->addWidget(messageLabel); // 创建按钮 QHBoxLayout *buttonLayout = new QHBoxLayout; QPushButton *yesButton = new QPushButton(tr("Yes"), this); QPushButton *noButton = new QPushButton(tr("No"), this); // 连接按钮的点击信号 connect(yesButton, SIGNAL(clicked()), this, SLOT(accept())); connect(noButton, SIGNAL(clicked()), this, SLOT(reject())); buttonLayout->addStretch(); buttonLayout->addWidget(yesButton); buttonLayout->addWidget(noButton); mainLayout->addLayout(buttonLayout); // 设置对话框的主布局 this->setLayout(mainLayout); }