atrooney-online-2/include/aoclocklabel.h
Crystalwarrior ee3bad44c7 Implement clock pausing
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.
2020-08-25 12:48:09 +03:00

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