Changeset View
Changeset View
Standalone View
Standalone View
tests/test_list_rust.h
Show All 37 Lines | 20 | public: | |||
---|---|---|---|---|---|
38 | Q_INVOKABLE bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; | 38 | Q_INVOKABLE bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; | ||
39 | Q_INVOKABLE bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; | 39 | Q_INVOKABLE bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; | ||
40 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; | 40 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; | ||
41 | Q_INVOKABLE quint8 userAge(int row) const; | 41 | Q_INVOKABLE quint8 userAge(int row) const; | ||
42 | Q_INVOKABLE bool setUserAge(int row, quint8 value); | 42 | Q_INVOKABLE bool setUserAge(int row, quint8 value); | ||
43 | Q_INVOKABLE QString userName(int row) const; | 43 | Q_INVOKABLE QString userName(int row) const; | ||
44 | Q_INVOKABLE bool setUserName(int row, const QString& value); | 44 | Q_INVOKABLE bool setUserName(int row, const QString& value); | ||
45 | 45 | | |||
46 | signals: | 46 | Q_SIGNALS: | ||
47 | // new data is ready to be made available to the model with fetchMore() | 47 | // new data is ready to be made available to the model with fetchMore() | ||
48 | void newDataReady(const QModelIndex &parent) const; | 48 | void newDataReady(const QModelIndex &parent) const; | ||
49 | private: | 49 | private: | ||
50 | QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData; | 50 | QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData; | ||
51 | void initHeaderData(); | 51 | void initHeaderData(); | ||
52 | void updatePersistentIndexes(); | 52 | void updatePersistentIndexes(); | ||
53 | signals: | 53 | Q_SIGNALS: | ||
54 | }; | 54 | }; | ||
55 | 55 | | |||
56 | class Persons : public QAbstractItemModel | 56 | class Persons : public QAbstractItemModel | ||
57 | { | 57 | { | ||
58 | Q_OBJECT | 58 | Q_OBJECT | ||
59 | public: | 59 | public: | ||
60 | class Private; | 60 | class Private; | ||
61 | private: | 61 | private: | ||
Show All 19 Lines | 65 | public: | |||
81 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; | 81 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; | ||
82 | bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override; | 82 | bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override; | ||
83 | Q_INVOKABLE bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; | 83 | Q_INVOKABLE bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; | ||
84 | Q_INVOKABLE bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; | 84 | Q_INVOKABLE bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; | ||
85 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; | 85 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; | ||
86 | Q_INVOKABLE QString userName(int row) const; | 86 | Q_INVOKABLE QString userName(int row) const; | ||
87 | Q_INVOKABLE bool setUserName(int row, const QString& value); | 87 | Q_INVOKABLE bool setUserName(int row, const QString& value); | ||
88 | 88 | | |||
89 | signals: | 89 | Q_SIGNALS: | ||
90 | // new data is ready to be made available to the model with fetchMore() | 90 | // new data is ready to be made available to the model with fetchMore() | ||
91 | void newDataReady(const QModelIndex &parent) const; | 91 | void newDataReady(const QModelIndex &parent) const; | ||
92 | private: | 92 | private: | ||
93 | QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData; | 93 | QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData; | ||
94 | void initHeaderData(); | 94 | void initHeaderData(); | ||
95 | void updatePersistentIndexes(); | 95 | void updatePersistentIndexes(); | ||
96 | signals: | 96 | Q_SIGNALS: | ||
97 | }; | 97 | }; | ||
98 | #endif // TEST_LIST_RUST_H | 98 | #endif // TEST_LIST_RUST_H |