ui/qt/model.cpp

changeset 109
c3dfcb8f0be7
parent 108
77254bd6dccb
--- a/ui/qt/model.cpp	Sun Jul 20 22:04:39 2025 +0200
+++ b/ui/qt/model.cpp	Sun Aug 24 15:24:16 2025 +0200
@@ -28,14 +28,6 @@
 
 #include "model.h"
 
-static void* model_getvalue(UiModel *model, UiList *list, void *elm, int row, int col, UiBool *freeResult) {
-    if(model->getvalue2) {
-        return model->getvalue2(list, elm, row, col, model->getvalue2data, freeResult);
-    } else if(model->getvalue) {
-        return model->getvalue(elm, col);
-    }
-    return NULL;
-}
 
 ListModel::ListModel(UiObject *obj, QListView *view, UiVar *var, ui_getvaluefunc2 getvalue, void *getvaluedata){
     this->obj = obj;
@@ -116,11 +108,13 @@
 
 
 
-TableModel::TableModel(UiObject *obj, QTreeView *view, UiVar *var, UiModel *model){
+TableModel::TableModel(UiObject *obj, QTreeView *view, UiVar *var, UiModel *model, ui_getvaluefunc2 getvalue, void *getvaluedata){
     this->obj = obj;
     this->view = view;
     this->var = var;
     this->model = model;
+    this->getvalue = getvalue;
+    this->getvaluedata = getvaluedata;
     this->onactivate = nullptr;
     this->onactivatedata = nullptr;
     this->onselection = nullptr;
@@ -162,7 +156,7 @@
         if(rowData) {
             int col = index.column();
             UiBool freeResult = false;
-            void *value = model_getvalue(model, ls, rowData, index.row(), col, &freeResult);
+            void *value = getvalue(ls, rowData, index.row(), col, getvaluedata, &freeResult);
             if(value) {
                 UiModelType type = model->types[col];
                 switch(type) {

mercurial