summaryrefslogtreecommitdiffstats
path: root/progressdialog.cpp
blob: 778a3b478e286682deec5d0b7828bb7050e7faf8 (plain)
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
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>

#include "progressdialog.h"

ProgressDialog::ProgressDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){
    mLabel = new QLabel;
    mProgress = new QProgressBar;
    QPushButton *cancelBtn = new QPushButton(tr("Cancel"));
    connect(cancelBtn, SIGNAL(clicked()), this, SIGNAL(cancelled()));
    QHBoxLayout *btnLayout = new QHBoxLayout;
    btnLayout->addStretch();
    btnLayout->addWidget(cancelBtn);
    btnLayout->addStretch();
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(mLabel);
    mainLayout->addWidget(mProgress);
    mainLayout->addLayout(btnLayout);
    setLayout(mainLayout);
}

void ProgressDialog::setValue(int val){
    mProgress->setValue(val);
}