-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogressbarwindow.cpp
More file actions
46 lines (38 loc) · 1.13 KB
/
progressbarwindow.cpp
File metadata and controls
46 lines (38 loc) · 1.13 KB
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
44
45
46
#include "progressbarwindow.h"
#include <QPushButton>
#include <QVBoxLayout>
#include <QSpacerItem>
#include <QApplication>
#include <QScreen>
ProgressBarWindow::ProgressBarWindow(QString text)
: QWidget()
{
setWindowTitle(text);
auto availableGeometry = QApplication::primaryScreen()->availableGeometry();
auto width = availableGeometry.width() * 0.2604166666666667;
auto height = width * 0.25;
setFixedSize(width, height);
setWindowFlag(Qt::WindowCloseButtonHint, false);
setWindowFlag(Qt::WindowMinimizeButtonHint, false);
auto mainLayout = new QVBoxLayout(this);
progressBar.setValue(0);
mainLayout->addWidget(&progressBar);
QPushButton* cancelButton = new QPushButton(tr("&Cancel"));
mainLayout->addWidget(cancelButton);
connect(
cancelButton,
&QPushButton::clicked,
this,
&ProgressBarWindow::cancelButtonPressed
);
setLayout(mainLayout);
}
void ProgressBarWindow::setMaxValue(int maxValue)
{
this->maxValue = maxValue;
progressBar.setMaximum(maxValue);
}
void ProgressBarWindow::setProgress(int value)
{
progressBar.setValue(value);
}