-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·45 lines (30 loc) · 1.13 KB
/
main.cpp
File metadata and controls
executable file
·45 lines (30 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
#include <QApplication>
#include <QtGui/QtGui>
#include "QProgressIndicator.h"
int main(int argc, char ** argv)
{
QApplication app(argc, argv);
QMainWindow * mw = new QMainWindow;
QProgressIndicator* pi = new QProgressIndicator();
QFrame* frame = new QFrame;
QVBoxLayout* vbl = new QVBoxLayout;
QPushButton* startPb = new QPushButton("start spin");
QObject::connect(startPb, SIGNAL(clicked(bool)), pi, SLOT(startAnimation()));
QPushButton* stopPb = new QPushButton("stop spin");
QObject::connect(stopPb, SIGNAL(clicked(bool)), pi, SLOT(stopAnimation()));
QSlider* delaySlider = new QSlider;
delaySlider->setRange(0, 100);
delaySlider->setValue(pi->animationDelay());
delaySlider->setOrientation(Qt::Horizontal);
QObject::connect(delaySlider, SIGNAL(valueChanged(int)), pi, SLOT(setAnimationDelay(int)));
vbl->addWidget(startPb);
vbl->addWidget(stopPb);
vbl->addWidget(delaySlider);
QHBoxLayout* hbl = new QHBoxLayout(frame);
hbl->addWidget(pi);
hbl->addLayout(vbl);
pi->startAnimation();
mw->setCentralWidget(frame);
mw->show();
return app.exec();
}