-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsplashdialog.cpp
More file actions
43 lines (36 loc) · 786 Bytes
/
Copy pathsplashdialog.cpp
File metadata and controls
43 lines (36 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "splashdialog.h"
#include "ui_splashdialog.h"
#include <QPainter>
#include <QImage>
#include <QTimer>
SplashDialog::SplashDialog(QWidget *parent, Qt::WindowFlags f) :
QDialog(parent, f),
isSplash(false),
ui(new Ui::SplashDialog)
{
ui->setupUi(this);
}
SplashDialog::~SplashDialog()
{
delete ui;
}
void SplashDialog::show()
{
if (isSplash)
{
ui->buttonBox->hide();
QTimer::singleShot(2500, [this]() -> void { close(); deleteLater(); });
}
QDialog::show();
}
void SplashDialog::paintEvent(QPaintEvent *)
{
QPainter p(this);
QImage img(":/Icons/Splash.png");
p.drawImage(0, 0, img);
if (isSplash)
{
p.setPen(QPen(QColor(0, 0, 0)));
p.drawRect(0, 0, width() - 1, height() - 1);
}
}