| 1 | // Copyright (C) 2025 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QQMLSYNCHRONIZER_P_H |
| 5 | #define QQMLSYNCHRONIZER_P_H |
| 6 | // |
| 7 | // W A R N I N G |
| 8 | // ------------- |
| 9 | // |
| 10 | // This file is not part of the Qt API. It exists purely as an |
| 11 | // implementation detail. This header file may change from version to |
| 12 | // version without notice, or even be removed. |
| 13 | // |
| 14 | // We mean it. |
| 15 | // |
| 16 | |
| 17 | #include <QtQml/private/qqmlfinalizer_p.h> |
| 18 | #include <QtQml/qqmlpropertyvaluesource.h> |
| 19 | #include <QtQmlMeta/qtqmlmetaexports.h> |
| 20 | #include <QtQmlIntegration/qqmlintegration.h> |
| 21 | #include <QtCore/qobject.h> |
| 22 | |
| 23 | #include <QtLabsSynchronizer/qtlabssynchronizerexports.h> |
| 24 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | class QQmlSynchronizerPrivate; |
| 28 | class Q_LABSSYNCHRONIZER_EXPORT QQmlSynchronizer |
| 29 | : public QObject, public QQmlPropertyValueSource, public QQmlFinalizerHook |
| 30 | { |
| 31 | Q_OBJECT |
| 32 | Q_DECLARE_PRIVATE(QQmlSynchronizer) |
| 33 | Q_INTERFACES(QQmlPropertyValueSource QQmlFinalizerHook) |
| 34 | Q_PROPERTY(QObject *sourceObject READ sourceObject WRITE setSourceObject |
| 35 | NOTIFY sourceObjectChanged FINAL) |
| 36 | Q_PROPERTY(QString sourceProperty READ sourceProperty WRITE setSourceProperty |
| 37 | NOTIFY sourcePropertyChanged FINAL) |
| 38 | Q_PROPERTY(QObject *targetObject READ targetObject WRITE setTargetObject |
| 39 | NOTIFY targetObjectChanged FINAL) |
| 40 | Q_PROPERTY(QString targetProperty READ targetProperty WRITE setTargetProperty |
| 41 | NOTIFY targetPropertyChanged FINAL) |
| 42 | QML_NAMED_ELEMENT(Synchronizer) |
| 43 | QML_ADDED_IN_VERSION(6, 10) |
| 44 | public: |
| 45 | QQmlSynchronizer(QObject *parent = nullptr); |
| 46 | |
| 47 | QObject *sourceObject() const; |
| 48 | void setSourceObject(QObject *object); |
| 49 | |
| 50 | QString sourceProperty() const; |
| 51 | void setSourceProperty(const QString &property); |
| 52 | |
| 53 | QObject *targetObject() const; |
| 54 | void setTargetObject(QObject *object); |
| 55 | |
| 56 | QString targetProperty() const; |
| 57 | void setTargetProperty(const QString &property); |
| 58 | |
| 59 | Q_SIGNALS: |
| 60 | void sourceObjectChanged(); |
| 61 | void sourcePropertyChanged(); |
| 62 | void targetObjectChanged(); |
| 63 | void targetPropertyChanged(); |
| 64 | |
| 65 | void valueBounced(QObject *object, const QString &property); |
| 66 | void valueIgnored(QObject *object, const QString &property); |
| 67 | |
| 68 | protected: |
| 69 | void setTarget(const QQmlProperty &target) final; |
| 70 | void componentFinalized() final; |
| 71 | }; |
| 72 | |
| 73 | QT_END_NAMESPACE |
| 74 | |
| 75 | #endif // QQMLSYNCHRONIZER_P_H |
| 76 |
