I tried many times, and now i have this declaration:
class ListModel : public QAbstractListModel
Qt Code:
  1. {
  2. Q_OBJECT
  3. public:
  4. ListModel(QVector<QStringList> &my2darray, QObject *parent = 0)
  5. : QAbstractListModel(parent), vector(my2darray){}
  6.  
  7. int rowCount(const QModelIndex &parent = QModelIndex()) const;
  8. QVariant data(const QModelIndex &index, int role) const;
  9.  
  10. private:
  11. QVector<QStringList> &vector;
  12. };
To copy to clipboard, switch view to plain text mode 

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
Qt Code:
  1. {
  2. if (!index.isValid())
  3. return QVariant();
  4.  
  5. if (index.row() >= 20)
  6. return QVariant();
  7.  
  8. if (role == Qt::DisplayRole)
  9. {
  10. int a = index.row();
  11. return Custom_Widget(vector[a][0], vector[a][1], vector[a][2], "");
  12. }
  13. else
  14. return QVariant();
  15. }
To copy to clipboard, switch view to plain text mode 

But it didn't worked. How should I alter my code to get it working?