25 lines
416 B
C
25 lines
416 B
C
|
|
#ifndef STOPWATCH_H
|
|||
|
|
#define STOPWATCH_H
|
|||
|
|
|
|||
|
|
#include <QTimer>
|
|||
|
|
#include <QElapsedTimer>
|
|||
|
|
#include <memory>
|
|||
|
|
|
|||
|
|
class StopWatch : public QObject {
|
|||
|
|
Q_OBJECT
|
|||
|
|
public:
|
|||
|
|
StopWatch();
|
|||
|
|
|
|||
|
|
void start();
|
|||
|
|
qint64 elapsed();
|
|||
|
|
private:
|
|||
|
|
std::unique_ptr<QElapsedTimer> m_elapsed = nullptr; ///< Keeps time
|
|||
|
|
std::unique_ptr<QTimer> m_timer = nullptr; ///< triggers updates
|
|||
|
|
|
|||
|
|
|
|||
|
|
private slots:
|
|||
|
|
void updateTimer();
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#endif // STOPWATCH_H
|