I tried many times, and now i have this declaration:
class ListModel : public QAbstractListModel
Code:
{ Q_OBJECT public: private: QVector<QStringList> &vector; };
I would like to know, what can i return as QVariant? Only strings? i need to return a custom_widget i created (it consists of 4 labels). I tried this code:
QVariant ListModel::data(const QModelIndex &index, int role) const
Code:
{ if (!index.isValid()) if (index.row() >= 20) if (role == Qt::DisplayRole) { int a = index.row(); return Custom_Widget(vector[a][0], vector[a][1], vector[a][2], ""); } else }
But it didn't worked. How should I alter my code to get it working?