--- a/ui/qt/list.cpp Tue Apr 22 20:40:01 2025 +0200 +++ b/ui/qt/list.cpp Thu Apr 24 21:19:29 2025 +0200 @@ -73,3 +73,40 @@ return view; } + +UIWIDGET ui_table_create(UiObject* obj, UiListArgs args) { + UiContainerPrivate *ctn = ui_obj_container(obj); + UI_APPLY_LAYOUT(ctn->layout, args); + + QTreeView *view = new QTreeView(); + view->setItemsExpandable(false); + view->setRootIsDecorated(false); + + UiVar* var = uic_widget_var(obj->ctx, obj->ctx, args.list, args.varname, UI_VAR_LIST); + + TableModel *model = new TableModel(obj, view, var, args.model); + view->setModel(model); + + if(var) { + UiList *list = (UiList*)var->value; + list->update = ui_listmodel_update; + list->getselection = ui_listmodel_getselection; + list->setselection = ui_listmodel_setselection; + list->obj = model; + } + + model->setActivationCallback(args.onactivate, args.onactivatedata); + model->setSelectionCallback(args.onselection, args.onselectiondata); + + QItemSelectionModel *s = view->selectionModel(); + QObject::connect( + s, + SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), + model, + SLOT(selectionChanged(const QItemSelection &, const QItemSelection &))); + + + ctn->add(view, false); + + return view; +}