QVariantList / QVariantMap to QML ListModel
-
Hi,
I'm using an QAbstractItemModel to display data on a QML TreeView. I have a list of items for a particular column in the table.
I have saved those items in a QVariantList. Is it possible to display this on the UI as a ListView?
QVariant DiffModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); DiffInfo* item = getItem(index); switch (role) { case ColumnRole: return item->rightColumn();//Return a QVariantList } return QVariant(); }
Kindly advice.
-
-
@p3c0 thanks
Could you provide me an example how to access the same in qml ?
-
@Valerian There is an example in the same document.
-
@p3c0 thanks again
Next problem I am facing is that, the items is the list view vary. As this list is displayed within a row of the table view, I require the each row to have variable height. Is it possible?
Kindly advice
-
@Valerian Not sure but you can try itemDelegate.
-
This post is deleted!