| 72 }; |
72 }; |
| 73 |
73 |
| 74 class TableModel : public QAbstractListModel { |
74 class TableModel : public QAbstractListModel { |
| 75 Q_OBJECT |
75 Q_OBJECT |
| 76 |
76 |
| 77 ui_getvaluefunc getvalue; |
77 UiModel *model; |
| 78 ui_callback onactivate; |
78 ui_callback onactivate; |
| 79 void *onactivatedata; |
79 void *onactivatedata; |
| 80 ui_callback onselection; |
80 ui_callback onselection; |
| 81 void *onselectiondata; |
81 void *onselectiondata; |
| 82 |
82 |
| 83 public: |
83 public: |
| 84 UiObject *obj; |
84 UiObject *obj; |
| 85 UiVar *var; |
85 UiVar *var; |
| 86 QTreeView *view; |
86 QTreeView *view; |
| 87 |
87 |
| 88 TableModel(UiObject *obj, QTreeView *view, UiVar *var, ui_getvaluefunc getvalue); |
88 TableModel(UiObject *obj, QTreeView *view, UiVar *var, UiModel *model); |
| 89 |
89 |
| 90 void setActivationCallback(ui_callback f, void *userdata); |
90 void setActivationCallback(ui_callback f, void *userdata); |
| 91 void setSelectionCallback(ui_callback f, void *userdata); |
91 void setSelectionCallback(ui_callback f, void *userdata); |
| 92 |
92 |
| 93 void update(int row); |
93 void update(int row); |
| 94 |
94 |
| 95 int rowCount(const QModelIndex &parent = QModelIndex()) const; |
95 int rowCount(const QModelIndex &parent = QModelIndex()) const; |
| |
96 int columnCount(const QModelIndex &parent = QModelIndex()) const; |
| 96 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
97 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
| |
98 QVariant headerData(int section, Qt::Orientation orientation, int role) const; |
| 97 |
99 |
| 98 public slots: |
100 public slots: |
| 99 void selectionChanged( |
101 void selectionChanged( |
| 100 const QItemSelection & selected, |
102 const QItemSelection & selected, |
| 101 const QItemSelection & deselected); |
103 const QItemSelection & deselected); |