--- a/ui/qt/model.h Mon Apr 21 19:32:57 2025 +0200 +++ b/ui/qt/model.h Tue Apr 22 20:40:01 2025 +0200 @@ -71,6 +71,36 @@ const QItemSelection & deselected); }; +class TableModel : public QAbstractListModel { + Q_OBJECT + + ui_getvaluefunc getvalue; + ui_callback onactivate; + void *onactivatedata; + ui_callback onselection; + void *onselectiondata; + +public: + UiObject *obj; + UiVar *var; + QTreeView *view; + + TableModel(UiObject *obj, QTreeView *view, UiVar *var, ui_getvaluefunc getvalue); + + void setActivationCallback(ui_callback f, void *userdata); + void setSelectionCallback(ui_callback f, void *userdata); + + void update(int row); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + +public slots: + void selectionChanged( + const QItemSelection & selected, + const QItemSelection & deselected); +}; + UiListSelection ui_selection_model_to_selection(QItemSelectionModel *model);