ui/qt/list.cpp

changeset 109
c3dfcb8f0be7
parent 108
77254bd6dccb
child 112
c3f2f16fa4b8
--- a/ui/qt/list.cpp	Sun Jul 20 22:04:39 2025 +0200
+++ b/ui/qt/list.cpp	Sun Aug 24 15:24:16 2025 +0200
@@ -42,6 +42,10 @@
     return getvalue(elm, col);
 }
 
+static void* null_getvalue(UiList *list, void *elm, int row, int col, void *userdata, UiBool *freeResult) {
+    return NULL;
+}
+
 UIWIDGET ui_listview_create(UiObject* obj, UiListArgs *args) {
     UiContainerPrivate *ctn = ui_obj_container(obj);
     UI_APPLY_LAYOUT(ctn->layout, args);
@@ -102,7 +106,17 @@
     
     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);
+    ui_getvaluefunc2 getvalue = args->getvalue2;
+    void *getvaluedata = args->getvalue2data;
+    if(!getvalue) {
+        if(args->getvalue) {
+            getvalue = getvalue_wrapper;
+            getvaluedata = (void*)args->getvalue;
+        } else {
+            getvalue = null_getvalue;
+        }
+    }
+    TableModel *model = new TableModel(obj, view, var, args->model, getvalue, getvaluedata);
     view->setModel(model);
     
     if(var) {

mercurial