Changeset View
Changeset View
Standalone View
Standalone View
tests/test_objects_rust.h
Show All 20 Lines | 18 | private: | |||
---|---|---|---|---|---|
21 | bool m_ownsPrivate; | 21 | bool m_ownsPrivate; | ||
22 | Q_PROPERTY(Person* person READ person NOTIFY personChanged FINAL) | 22 | Q_PROPERTY(Person* person READ person NOTIFY personChanged FINAL) | ||
23 | explicit Group(bool owned, QObject *parent); | 23 | explicit Group(bool owned, QObject *parent); | ||
24 | public: | 24 | public: | ||
25 | explicit Group(QObject *parent = nullptr); | 25 | explicit Group(QObject *parent = nullptr); | ||
26 | ~Group(); | 26 | ~Group(); | ||
27 | const Person* person() const; | 27 | const Person* person() const; | ||
28 | Person* person(); | 28 | Person* person(); | ||
29 | signals: | 29 | Q_SIGNALS: | ||
30 | void personChanged(); | 30 | void personChanged(); | ||
31 | }; | 31 | }; | ||
32 | 32 | | |||
33 | class InnerObject : public QObject | 33 | class InnerObject : public QObject | ||
34 | { | 34 | { | ||
35 | Q_OBJECT | 35 | Q_OBJECT | ||
36 | friend class Group; | 36 | friend class Group; | ||
37 | friend class Person; | 37 | friend class Person; | ||
38 | public: | 38 | public: | ||
39 | class Private; | 39 | class Private; | ||
40 | private: | 40 | private: | ||
41 | Private * m_d; | 41 | Private * m_d; | ||
42 | bool m_ownsPrivate; | 42 | bool m_ownsPrivate; | ||
43 | Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged FINAL) | 43 | Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged FINAL) | ||
44 | explicit InnerObject(bool owned, QObject *parent); | 44 | explicit InnerObject(bool owned, QObject *parent); | ||
45 | public: | 45 | public: | ||
46 | explicit InnerObject(QObject *parent = nullptr); | 46 | explicit InnerObject(QObject *parent = nullptr); | ||
47 | ~InnerObject(); | 47 | ~InnerObject(); | ||
48 | QString description() const; | 48 | QString description() const; | ||
49 | void setDescription(const QString& v); | 49 | void setDescription(const QString& v); | ||
50 | signals: | 50 | Q_SIGNALS: | ||
51 | void descriptionChanged(); | 51 | void descriptionChanged(); | ||
52 | }; | 52 | }; | ||
53 | 53 | | |||
54 | class Person : public QObject | 54 | class Person : public QObject | ||
55 | { | 55 | { | ||
56 | Q_OBJECT | 56 | Q_OBJECT | ||
57 | friend class Group; | 57 | friend class Group; | ||
58 | public: | 58 | public: | ||
59 | class Private; | 59 | class Private; | ||
60 | private: | 60 | private: | ||
61 | InnerObject* const m_object; | 61 | InnerObject* const m_object; | ||
62 | Private * m_d; | 62 | Private * m_d; | ||
63 | bool m_ownsPrivate; | 63 | bool m_ownsPrivate; | ||
64 | Q_PROPERTY(InnerObject* object READ object NOTIFY objectChanged FINAL) | 64 | Q_PROPERTY(InnerObject* object READ object NOTIFY objectChanged FINAL) | ||
65 | explicit Person(bool owned, QObject *parent); | 65 | explicit Person(bool owned, QObject *parent); | ||
66 | public: | 66 | public: | ||
67 | explicit Person(QObject *parent = nullptr); | 67 | explicit Person(QObject *parent = nullptr); | ||
68 | ~Person(); | 68 | ~Person(); | ||
69 | const InnerObject* object() const; | 69 | const InnerObject* object() const; | ||
70 | InnerObject* object(); | 70 | InnerObject* object(); | ||
71 | signals: | 71 | Q_SIGNALS: | ||
72 | void objectChanged(); | 72 | void objectChanged(); | ||
73 | }; | 73 | }; | ||
74 | #endif // TEST_OBJECTS_RUST_H | 74 | #endif // TEST_OBJECTS_RUST_H |