Could somebody help me?
I have build a model based on QAbstractListModel with such inner structure:
QList <QPair<QString,QPair<QImage,QPair<QStringList,QStringList> > > > mainMap;
QList <QPair<QString,QPair<QImage,QPair<QStringList,QStringList> > > > mainMap;
To copy to clipboard, switch view to plain text mode
in data method of this model, I describe:
{
if (!index.
isValid()) return QVariant();
if (!index.
row() >
= mainMap.
size()) return QVariant();
if (role == Qt::DisplayRole) return mainMap.at(index.row());
}
QVariant MainModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) return QVariant();
if (!index.row() >= mainMap.size()) return QVariant();
if (role == Qt::DisplayRole) return mainMap.at(index.row());
else return QVariant();
}
To copy to clipboard, switch view to plain text mode
In which method view (based on QAbstractItemView or QAbstractListView) I need to state what data from mainMap I need to use in order to show in view (for example, I need to show mainMap.at(index.row()).first in the first list, and mainMap.at(index.row()).second.second.first) in the second one)?
Bookmarks