| 42 |
42 |
| 43 |
43 |
| 44 class ListModel : public QAbstractListModel { |
44 class ListModel : public QAbstractListModel { |
| 45 Q_OBJECT |
45 Q_OBJECT |
| 46 |
46 |
| |
47 ui_getvaluefunc getvalue; |
| |
48 ui_callback onactivate; |
| |
49 void *onactivatedata; |
| |
50 ui_callback onselection; |
| |
51 void *onselectiondata; |
| |
52 |
| |
53 public: |
| 47 UiObject *obj; |
54 UiObject *obj; |
| 48 UiVar *var; |
55 UiVar *var; |
| 49 ui_getvaluefunc getvalue; |
|
| 50 ui_callback callback; |
|
| 51 void *userdata; |
|
| 52 QListView *view; |
56 QListView *view; |
| 53 |
57 |
| 54 public: |
58 ListModel(UiObject *obj, QListView *view, UiVar *var, ui_getvaluefunc getvalue); |
| 55 ListModel(UiObject *obj, QListView *view, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *userdata); |
59 |
| |
60 void setActivationCallback(ui_callback f, void *userdata); |
| |
61 void setSelectionCallback(ui_callback f, void *userdata); |
| |
62 |
| |
63 void update(int row); |
| 56 |
64 |
| 57 int rowCount(const QModelIndex &parent = QModelIndex()) const; |
65 int rowCount(const QModelIndex &parent = QModelIndex()) const; |
| 58 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
66 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
| 59 |
67 |
| 60 public slots: |
68 public slots: |
| 62 const QItemSelection & selected, |
70 const QItemSelection & selected, |
| 63 const QItemSelection & deselected); |
71 const QItemSelection & deselected); |
| 64 }; |
72 }; |
| 65 |
73 |
| 66 |
74 |
| |
75 UiListSelection ui_selection_model_to_selection(QItemSelectionModel *model); |
| |
76 |
| |
77 extern "C" { |
| |
78 |
| |
79 void ui_listmodel_update(UiList *list, int row); |
| |
80 void ui_listmodel_setselection(UiList *list, UiListSelection sel); |
| |
81 UiListSelection ui_listmodel_getselection(UiList *list); |
| |
82 |
| |
83 } |
| 67 |
84 |
| 68 #endif /* MODEL_H */ |
85 #endif /* MODEL_H */ |
| 69 |
86 |