QStandardItem *item = new QStandardItem("Item caption");item->setData(anyData1, Qt::UserRole + 1);item->setData(anyData2, Qt::UserRole + 2);...model->setItem(rowIdx, colIdx, item);
AnyDataType data1 = listView->currentIndex.data(Qt::UserRole + 1).value<AnyDataType>();AnyDataType data2 = listView->currentIndex.data(Qt::UserRole + 2).value<AnyDataType>();
QListWidgetItem *item = new QListWidgetItem(itemText, listWidget);item->setData(Qt::UserRole, pointer);
PointerType pointer = listWidget->item(rowIndex)->data(Qt::UserRole).value<PointerType>();
struct IDX { QString fldName; int non_unique; QString index_type; int sub_part; QString fldType;};Q_DECLARE_METATYPE(IDX); IDX idx = item->data(Qt::UserRole).value<IDX>(); QVariant v; v.setValue(idx); item->setData(Qt::UserRole,v);