#ifndef SPEEDTIMERQMLADAPTER_H #define SPEEDTIMERQMLADAPTER_H #include #include #include "speedtimer.h" class SpeedTimerQmlAdapter : public QObject { Q_OBJECT Q_PROPERTY(QString state READ getState NOTIFY stateChanged) //Q_PROPERTY(int currtime READ getCurrTime) Q_PROPERTY(QString text READ getText NOTIFY textChanged) public: explicit SpeedTimerQmlAdapter(QObject *parent = nullptr); SpeedTimer::timerState state; // variables for capturing the time double startTime; double stopTime; double stoppedTime; double reactionTime; QString text; signals: void stateChanged(SpeedTimer::timerState newState); Q_SIGNAL void startCanceled(bool falseStart); void textChanged(); public slots: Q_INVOKABLE bool setStarting(); Q_INVOKABLE bool start(); Q_INVOKABLE bool stop(QString type); Q_INVOKABLE bool reset(); void setState(SpeedTimer::timerState newState); Q_INVOKABLE QString getState(); Q_INVOKABLE QString getText(); // double getCurrTime(); private: QTimer * refreshTimer; private slots: void refreshValues(); }; #endif // SPEEDTIMERQMLADAPTER_H