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