ui/qt/model.h

changeset 581
7486347f73cf
parent 579
810b848e2e4f
child 582
6c86efe60b37
equal deleted inserted replaced
580:9b8d61227169 581:7486347f73cf
69 void selectionChanged( 69 void selectionChanged(
70 const QItemSelection & selected, 70 const QItemSelection & selected,
71 const QItemSelection & deselected); 71 const QItemSelection & deselected);
72 }; 72 };
73 73
74 class TableModel : public QAbstractListModel {
75 Q_OBJECT
76
77 ui_getvaluefunc getvalue;
78 ui_callback onactivate;
79 void *onactivatedata;
80 ui_callback onselection;
81 void *onselectiondata;
82
83 public:
84 UiObject *obj;
85 UiVar *var;
86 QTreeView *view;
87
88 TableModel(UiObject *obj, QTreeView *view, UiVar *var, ui_getvaluefunc getvalue);
89
90 void setActivationCallback(ui_callback f, void *userdata);
91 void setSelectionCallback(ui_callback f, void *userdata);
92
93 void update(int row);
94
95 int rowCount(const QModelIndex &parent = QModelIndex()) const;
96 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
97
98 public slots:
99 void selectionChanged(
100 const QItemSelection & selected,
101 const QItemSelection & deselected);
102 };
103
74 104
75 UiListSelection ui_selection_model_to_selection(QItemSelectionModel *model); 105 UiListSelection ui_selection_model_to_selection(QItemSelectionModel *model);
76 106
77 extern "C" { 107 extern "C" {
78 108

mercurial