QtDataSync  4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
qqmlsyncmanager.h
1 #ifndef QQMLSYNCMANAGER_H
2 #define QQMLSYNCMANAGER_H
3 
4 #include <QtCore/QObject>
5 
6 #include <QtQml/QQmlParserStatus>
7 #include <QtQml/QJSValue>
8 
9 #include <QtDataSync/syncmanager.h>
10 
11 #ifdef DOXYGEN_RUN
13 
21 #else
22 namespace QtDataSync {
23 
24 class QQmlSyncManager : public SyncManager, public QQmlParserStatus
25 #endif
26 {
27  Q_OBJECT
28  Q_DISABLE_COPY(QQmlSyncManager)
29  Q_INTERFACES(QQmlParserStatus)
30 
31 
47  Q_PROPERTY(QString setupName READ setupName WRITE setSetupName NOTIFY setupNameChanged)
64  Q_PROPERTY(QRemoteObjectNode* node READ node WRITE setNode NOTIFY nodeChanged)
80  Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
81 
82 public:
84  explicit QQmlSyncManager(QObject *parent = nullptr);
85 
87  void classBegin() override;
89  void componentComplete() override;
90 
92  QString setupName() const;
94  QRemoteObjectNode* node() const;
96  bool valid() const;
97 
99  Q_INVOKABLE void runOnDownloaded(const QJSValue &resultFn, bool triggerSync = true);
101  Q_INVOKABLE void runOnSynchronized(const QJSValue &resultFn, bool triggerSync = true);
102 
103 public Q_SLOTS:
105  void setSetupName(QString setupName);
107  void setNode(QRemoteObjectNode* node);
108 
109 Q_SIGNALS:
111  void setupNameChanged(const QString &setupName);
113  void nodeChanged(QRemoteObjectNode* node);
115  void validChanged(bool valid);
116 
117 private:
118  QString _setupName;
119  QRemoteObjectNode *_node;
120  bool _valid;
121 };
122 
123 }
124 
125 #endif // QQMLSYNCMANAGER_H
void setupNameChanged(const QString &setupName)
NOTIFY accessor for AccountManager::setupName.
The QML import for the QtDataSync QML module.
The primary namespace of the QtDataSync library.
Q_INVOKABLE void runOnSynchronized(const QJSValue &resultFn, bool triggerSync=true)
Performs an operation once all changes have been synchronized (both directions)
Q_INVOKABLE void runOnDownloaded(const QJSValue &resultFn, bool triggerSync=true)
Performs an operation once all changes have been downloaded.
void validChanged(bool valid)
NOTIFY accessor for AccountManager::valid.
void nodeChanged(QRemoteObjectNode *node)
NOTIFY accessor for AccountManager::node.
The QML binding of QtDataSync::SyncManager.
QObject * parent() const const