
Implement clock setting w/o starting or stopping Both of these should make it possible for the server to start/stop/pause/resume the clock with perfect synchronization to the true time.
30 lines
501 B
C++
30 lines
501 B
C++
#ifndef AOCLOCKLABEL_H
|
|
#define AOCLOCKLABEL_H
|
|
|
|
#include <QLabel>
|
|
#include <QBasicTimer>
|
|
#include <QTimerEvent>
|
|
#include <QTime>
|
|
#include <QDebug>
|
|
|
|
class AOClockLabel : public QLabel {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
AOClockLabel(QWidget *parent);
|
|
void start();
|
|
void start(int msecs);
|
|
void set(int msecs, bool update_text=false);
|
|
void pause();
|
|
void stop();
|
|
|
|
protected:
|
|
void timerEvent(QTimerEvent *event) override;
|
|
|
|
private:
|
|
QBasicTimer timer;
|
|
QTime target_time;
|
|
};
|
|
|
|
#endif // AOCLOCKLABEL_H
|