2024-11-25 17:15:44 +08:00

56 lines
1.0 KiB
C++

#include "quitgamedialog.h"
#include "ui_quitgamedialog.h"
#include <QPainter>
QuitGameDialog::QuitGameDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::QuitGameDialog),
m_result(0)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint); //设置无边框
setAttribute(Qt::WA_TranslucentBackground,true);
}
QuitGameDialog::~QuitGameDialog()
{
delete ui;
}
int QuitGameDialog::getResult()
{
return m_result;
}
void QuitGameDialog::on_cancel_Btn_clicked()
{
m_result = 0;
this->close();
}
void QuitGameDialog::on_confirm_Btn_clicked()
{
m_result = 1;
this->close();
}
void QuitGameDialog::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
QPainter painter(this);
painter.fillRect(rect(),QColor(0,0,0,100));
}
void QuitGameDialog::changeEvent(QEvent* event)
{
switch (event->type())
{
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
QWidget::changeEvent(event);
break;
}
}