// Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #ifndef TIMEMODEL_H #define TIMEMODEL_H #include #include #include #include #include class TimeModel : public QObject { Q_OBJECT Q_PROPERTY(int hour READ hour BINDABLE hourBindable FINAL) Q_PROPERTY(int minute READ minute BINDABLE minuteBindable FINAL) QML_NAMED_ELEMENT(Time) public: TimeModel(QObject *parent=nullptr); int minute() const { return m_minute.value(); } int hour() const { return m_hour.value(); } QBindable hourBindable() { return QBindable(&m_hour); } QBindable minuteBindable() { return QBindable(&m_minute); } private: void timerEvent(QTimerEvent *) override; QProperty m_minute; QProperty m_hour; QProperty m_time; QBasicTimer timer; }; #endif // TIMEMODEL_H