NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
customprogressbar.h
Go to the documentation of this file.
1
18#ifndef CUSTOMPROGRESSBAR_H
19#define CUSTOMPROGRESSBAR_H
20
21#include <QProgressBar>
22#include <QTimer>
23
29class CustomProgressBar : public QProgressBar {
30 Q_OBJECT
31
32public:
37 CustomProgressBar(QWidget* parent = nullptr) : QProgressBar(parent) {
38 setMinimum(0);
39 setMaximum(100);
40 setTextVisible(false);
41 hide();
42 timer_ = new QTimer(this);
43 timer_->setSingleShot(true);
44 connect(timer_, &QTimer::timeout, this, &CustomProgressBar::hide);
45 }
46
51 delete timer_;
52 }
53
58 void start() {
59 show();
60 timer_->stop();
61 emit progressStarted();
62 }
63
69 void stop() {
70 timer_->start(5000);
71 emit progressStopped();
72 }
73
74signals:
80
86
87private:
88 QTimer* timer_;
89};
90
91#endif // CUSTOMPROGRESSBAR_H
The CustomProgressBar class provides a customized progress bar with start and stop functionality.
Definition customprogressbar.h:29
CustomProgressBar(QWidget *parent=nullptr)
Constructs a CustomProgressBar object.
Definition customprogressbar.h:37
void progressStarted()
Signal emitted when the progress starts.
void stop()
Stops the progress bar.
Definition customprogressbar.h:69
void start()
Starts the progress bar.
Definition customprogressbar.h:58
~CustomProgressBar()
Destroys the CustomProgressBar object.
Definition customprogressbar.h:50
void progressStopped()
Signal emitted when the progress stops.