| 1 | // Copyright (C) 2020 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef QMLTIME_H |
| 5 | #define QMLTIME_H |
| 6 | |
| 7 | #include <QtCore/qobject.h> |
| 8 | #include <QtQml/qqml.h> |
| 9 | #include <QtQml/qqmlcomponent.h> |
| 10 | #include <QtQuick/qquickview.h> |
| 11 | |
| 12 | class Timer : public QObject |
| 13 | { |
| 14 | Q_OBJECT |
| 15 | Q_PROPERTY(QQmlComponent *component READ component WRITE setComponent) |
| 16 | QML_ELEMENT |
| 17 | |
| 18 | public: |
| 19 | Timer(); |
| 20 | |
| 21 | QQmlComponent *component() const; |
| 22 | void setComponent(QQmlComponent *); |
| 23 | |
| 24 | static Timer *timerInstance(); |
| 25 | |
| 26 | void run(uint); |
| 27 | |
| 28 | bool willParent() const; |
| 29 | void setWillParent(bool p); |
| 30 | |
| 31 | private: |
| 32 | void runTest(QQmlContext *, uint); |
| 33 | |
| 34 | QQmlComponent *m_component; |
| 35 | static Timer *m_timer; |
| 36 | |
| 37 | bool m_willparent; |
| 38 | QQuickView m_view; |
| 39 | QQuickItem *m_item; |
| 40 | }; |
| 41 | |
| 42 | #endif // QMLTIME_H |
| 43 |
