OSSIA
Open Scenario System for Interactive Application
qml_sync.hpp
1 #pragma once
3 
4 #include <ossia-qt/score/qml_cond.hpp>
5 
6 #include <QQmlExpression>
7 #include <QQmlListProperty>
8 #include <QQmlScriptString>
9 #include <QQuickItem>
10 
11 #include <verdigris>
12 namespace ossia
13 {
14 namespace qt
15 {
16 class qml_cond;
17 class qml_sync : public QQuickItem
18 {
19  W_OBJECT(qml_sync)
20 
21 public:
22  qml_sync(QQuickItem* parent = nullptr);
23  ~qml_sync() override;
24 
25  QQmlScriptString expr() const;
26  qml_cond* defaultCond();
27 
28  void registerCond(qml_cond*);
29  void unregisterCond(qml_cond*);
30 
31  void setup();
32  std::shared_ptr<ossia::time_sync> sync() const { return m_impl; }
33  void setSync(std::shared_ptr<ossia::time_sync> s) { m_impl = s; }
34 
35 public:
36  void setExpr(QQmlScriptString expr);
37  W_SLOT(setExpr);
38 
39 public:
40  void exprChanged(QQmlScriptString expr) E_SIGNAL(OSSIA_EXPORT, exprChanged, expr);
41 
42 private:
43  void reset();
44  QQmlScriptString m_expr;
45  std::shared_ptr<ossia::time_sync> m_impl;
46  qml_cond m_default;
47  ossia::hash_set<qml_cond*> m_conds;
48 
49  W_PROPERTY(QQmlScriptString, expr READ expr WRITE setExpr NOTIFY exprChanged)
50 };
51 }
52 }
Definition: git_info.h:7