-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.cpp
More file actions
48 lines (38 loc) · 677 Bytes
/
Copy pathclock.cpp
File metadata and controls
48 lines (38 loc) · 677 Bytes
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
#include "clock.h"
Clock::Clock(QObject *parent) : QObject(parent)
{
}
void Clock::setInterval(int mSecs)
{
this->interval = mSecs;
}
void Clock::updateInterval(int mSecs)
{
this->interval = mSecs;
this->timer->setInterval(interval);
}
int Clock::getInterval()
{
return this->timer->interval();
}
void Clock::MyTimerSlot()
{
tick();
emit ClockTick(this->ticks);
}
void Clock::start()
{
timer = new QTimer(this);
// setup signal and slot
connect(timer, SIGNAL(timeout()),
this, SLOT(MyTimerSlot()));
timer->start(interval);
}
void Clock::tick()
{
++this->ticks;
}
int Clock::getTicks()
{
return this->ticks;
}