# HG changeset patch # User Olaf Wintermann # Date 1745611470 -7200 # Node ID 30083c6cb198f77549c8d2d84b4d7b2d890c8404 # Parent 6c86efe60b37aa7131ed6a3b325d4ba8717e8383 implement more table column types (QT) diff -r 6c86efe60b37 -r 30083c6cb198 ui/qt/model.cpp --- a/ui/qt/model.cpp Thu Apr 24 21:19:29 2025 +0200 +++ b/ui/qt/model.cpp Fri Apr 25 22:04:30 2025 +0200 @@ -70,7 +70,9 @@ void *rowData = ls->get(ls, index.row()); if(rowData && getvalue) { void *value = getvalue(rowData, 0); - return QString::fromUtf8((char*)value); + if(value) { + return QString::fromUtf8((char*)value); + } } } return QVariant(); @@ -143,8 +145,34 @@ UiList *ls = (UiList*)var->value; void *rowData = ls->get(ls, index.row()); if(rowData && model->getvalue) { - void *value = model->getvalue(rowData, index.column()); - return QString::fromUtf8((char*)value); + int col = index.column(); + void *value = model->getvalue(rowData, col); + if(value) { + UiModelType type = model->types[col]; + switch(type) { + case UI_STRING: { + return QString::fromUtf8((char*)value); + } + case UI_STRING_FREE: { + QString s = QString::fromUtf8((char*)value); + free(value); + return s; + } + case UI_INTEGER: { + int *i = (int*)value; + return QString::number(*i); + } + case UI_ICON: { + break; + } + case UI_ICON_TEXT: { + break; + } + case UI_ICON_TEXT_FREE: { + break; + } + } + } } } return QVariant();