-
Notifications
You must be signed in to change notification settings - Fork 1
/
lcdnumber.h
52 lines (41 loc) · 1.05 KB
/
lcdnumber.h
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
52
/**
* @file lcdnumber.h
* @brief contiene la definicion del cronometro utilizado en la interfaz del sudoku.
* @author Luis Caviedes
* @author Luis Vasquez
*
* @date 07/07/2013
*/
#ifndef LCDNUMBER_H
#define LCDNUMBER_H
#include <QLCDNumber>
#include <QtGui>
class LCDNumber: public QLCDNumber
{
Q_OBJECT
public:
QTimer* timer;
QTime* timeValue;
public:
LCDNumber(int minutes,int seconds){
timer = new QTimer();
timeValue = new QTime(0,minutes,seconds,0);
this->display(timeValue->toString(QString("mm:ss")));
QObject::connect(timer,SIGNAL(timeout()),this,SLOT(setDisplay()));
}
~ LCDNumber(){
};
public slots:
void setDisplay()
{
this->timeValue->setHMS(0,this->timeValue->addMSecs(+1).minute(),
this->timeValue->addMSecs(+1).second(),
this->timeValue->addMSecs(+1).msec());
this->display(this->timeValue->toString(QString("mm:ss")));
}
void start(){
this->timer->start(1);}
void stop(){
this->timer->stop();}
};
#endif