See Model\View programming in QT docs.

ExampleModel is for data in table. It contains _headerModel. _headerModel discribes header structure.
If you want add rows in table, implement rowCount in Example model (now it returns 0, i.e. no rows), and handle DisplayRole in data.
Qt Code:
  1. QVariant data(const QModelIndex& index, int role) const
  2. {
  3. if(role==Qt::UserRole)
  4. {
  5. v.setValue((QObject*)&_headerModel);
  6. return v;
  7. }
  8. if(role==Qt::DisplayRole && index.isValid())
  9. {
  10. return QString("row %1 column %2").arg(index.row()).arg(index.column());
  11. }
  12. return QVariant();
  13. }
To copy to clipboard, switch view to plain text mode