|
@@ -23,32 +23,31 @@
|
|
|
#include "Chronometre.h"
|
|
|
#include <QTimer>
|
|
|
#include <QWidget>
|
|
|
-#include <QLCDNumber>
|
|
|
+#include <QLabel>
|
|
|
#include <QObject>
|
|
|
#include <QHBoxLayout>
|
|
|
+#include <QDebug>
|
|
|
|
|
|
Chronometre::Chronometre (const QString & nom , QWidget * parent = 0) : QGroupBox (nom , parent) {
|
|
|
- setFlat (false);
|
|
|
|
|
|
heure = 0;
|
|
|
minute = 0;
|
|
|
seconde = 0;
|
|
|
centieme = 0;
|
|
|
|
|
|
- ecranHeure = new QLCDNumber (2, this);
|
|
|
- ecranMinute = new QLCDNumber (2, this);
|
|
|
- ecranSeconde = new QLCDNumber (2, this);
|
|
|
- ecranCentieme = new QLCDNumber (2 , this);
|
|
|
- ecranHeure->setSegmentStyle (QLCDNumber::Flat);
|
|
|
- ecranMinute->setSegmentStyle (QLCDNumber::Flat);
|
|
|
- ecranSeconde->setSegmentStyle (QLCDNumber::Flat);
|
|
|
- ecranCentieme->setSegmentStyle (QLCDNumber::Flat);
|
|
|
+ ecranHeure = new QLabel ("00", this);
|
|
|
+ ecranMinute = new QLabel ("00" , this);
|
|
|
+ ecranSeconde = new QLabel ("00" , this);
|
|
|
+ ecranCentieme = new QLabel ("00" , this);
|
|
|
|
|
|
ecranLayout = new QHBoxLayout;
|
|
|
- ecranLayout->addWidget(ecranHeure);
|
|
|
- ecranLayout->addWidget(ecranMinute);
|
|
|
- ecranLayout->addWidget(ecranSeconde);
|
|
|
- ecranLayout->addWidget(ecranCentieme);
|
|
|
+ ecranLayout->addWidget(ecranHeure, Qt::AlignLeft);
|
|
|
+ ecranLayout->addWidget(new QLabel(":"));
|
|
|
+ ecranLayout->addWidget(ecranMinute , Qt::AlignLeft);
|
|
|
+ ecranLayout->addWidget(new QLabel(":"));
|
|
|
+ ecranLayout->addWidget(ecranSeconde, Qt::AlignLeft);
|
|
|
+ ecranLayout->addWidget(new QLabel(":"));
|
|
|
+ ecranLayout->addWidget(ecranCentieme, Qt::AlignLeft);
|
|
|
|
|
|
setLayout (ecranLayout);
|
|
|
|
|
@@ -110,11 +109,22 @@ int Chronometre::getCentieme () {
|
|
|
return centieme;
|
|
|
}
|
|
|
|
|
|
+QString Chronometre::qString (int nombre) {
|
|
|
+ QString qNombre;
|
|
|
+ qNombre = "<b>";
|
|
|
+ if (nombre < 10) {
|
|
|
+ qNombre.append("0");
|
|
|
+ }
|
|
|
+ qNombre.append(QString::number(nombre));
|
|
|
+ qNombre.append("</b>");
|
|
|
+ return qNombre;
|
|
|
+}
|
|
|
+
|
|
|
void Chronometre::affichage () {
|
|
|
- ecranHeure->display(heure);
|
|
|
- ecranMinute->display(minute);
|
|
|
- ecranSeconde->display(seconde);
|
|
|
- ecranCentieme->display (centieme);
|
|
|
+ ecranHeure->setText(qString (heure));
|
|
|
+ ecranMinute->setText(qString(minute));
|
|
|
+ ecranSeconde->setText(qString(seconde));
|
|
|
+ ecranCentieme->setText(qString(centieme));
|
|
|
}
|
|
|
|
|
|
void Chronometre::reinit () {
|