-
Notifications
You must be signed in to change notification settings - Fork 0
/
progressbar.cpp
51 lines (41 loc) · 1.01 KB
/
progressbar.cpp
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
47
48
49
50
51
#include "progressbar.h"
#include <QVBoxLayout>
#include <QMouseEvent>
#include <QSpacerItem>
#include <QDebug>
progressBar::progressBar(QWidget *parent) :
QWidget(parent),
_progressBar(new QProgressBar)
{
QVBoxLayout * layout = new QVBoxLayout;
layout->addWidget(_progressBar);
_progressBar->setMinimum(0);
_progressBar->setMaximum(0);
_progressBar->setTextVisible(false);
this->setLayout(layout);
}
progressBar::~progressBar()
{
}
void progressBar::setProgressBarValue(qint64 value)
{
_progressBar->setValue(value);
}
void progressBar::setProgressBarMaximum(qint64 maximum)
{
_progressBar->setMaximum(maximum);
}
void progressBar::progressBarValueChanged(int value)
{
emit valueChanged(value);
}
void progressBar::mousePressEvent(QMouseEvent * event)
{
int value = ((_progressBar->maximum()*event->x())/this->width());
_progressBar->setValue(value);
emit valueChanged(value);
}
void progressBar::mouseMoveEvent(QMouseEvent * event)
{
mousePressEvent(event);
}