| 37 #include <QAbstractListModel> |
37 #include <QAbstractListModel> |
| 38 #include <QAbstractTableModel> |
38 #include <QAbstractTableModel> |
| 39 #include <QAbstractItemModel> |
39 #include <QAbstractItemModel> |
| 40 #include <QItemSelectionModel> |
40 #include <QItemSelectionModel> |
| 41 |
41 |
| 42 class ListModel : public QAbstractListModel { |
|
| 43 Q_OBJECT |
|
| 44 |
|
| 45 UiObject *obj; |
|
| 46 UiListPtr *list; |
|
| 47 ui_model_getvalue_f getvalue; |
|
| 48 ui_callback callback; |
|
| 49 void *userdata; |
|
| 50 QListView *view; |
|
| 51 |
|
| 52 public: |
|
| 53 ListModel(UiObject *obj, QListView *view, UiListPtr *list, ui_model_getvalue_f getvalue, ui_callback f, void *userdata); |
|
| 54 |
|
| 55 int rowCount(const QModelIndex &parent = QModelIndex()) const; |
|
| 56 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
|
| 57 |
|
| 58 public slots: |
|
| 59 void selectionChanged( |
|
| 60 const QItemSelection & selected, |
|
| 61 const QItemSelection & deselected); |
|
| 62 }; |
|
| 63 |
|
| 64 class TableModel : public QAbstractTableModel { |
|
| 65 Q_OBJECT |
|
| 66 |
|
| 67 UiObject *obj; |
|
| 68 UiListPtr *list; |
|
| 69 UiModelInfo *info; |
|
| 70 QTreeView *view; |
|
| 71 public: |
|
| 72 TableModel(UiObject *obj, QTreeView *view, UiListPtr *list, UiModelInfo *info); |
|
| 73 |
|
| 74 int rowCount(const QModelIndex &parent = QModelIndex()) const; |
|
| 75 int columnCount(const QModelIndex &parent = QModelIndex()) const; |
|
| 76 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
|
| 77 QVariant headerData(int section, Qt::Orientation orientation, int role) const; |
|
| 78 |
|
| 79 void update(); |
|
| 80 |
|
| 81 public slots: |
|
| 82 void selectionChanged( |
|
| 83 const QItemSelection & selected, |
|
| 84 const QItemSelection & deselected); |
|
| 85 void activate(const QModelIndex &); |
|
| 86 }; |
|
| 87 |
|
| 88 UiListSelection* listSelection(QItemSelectionModel *s); |
|
| 89 |
42 |
| 90 #endif /* MODEL_H */ |
43 #endif /* MODEL_H */ |
| 91 |
44 |