I expect setData() below to store the string somewhere in the model but the call fails. Do I do something wrong or do I misunderstand what setData() is doing. Same for setHeaderdata()

The simplest code that fails to build the model as I expect is a header file .hpp

Qt Code:
  1. #include <QAbstractTableModel>
  2.  
  3. class Model : public QAbstractTableModel
  4. {
  5. Q_OBJECT
  6. public:
  7. Model(QObject *parent = 0) : QAbstractTableModel(parent) {};
  8.  
  9. void setSize(int r, int c) {
  10. rows = r;
  11. cols = c;
  12. }
  13.  
  14. int rowCount(const QModelIndex &parent = QModelIndex()) const { return rows; };
  15. int columnCount(const QModelIndex &parent = QModelIndex()) const { return cols; };;
  16.  
  17. QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
  18. { return QVariant(); };
  19. QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const
  20. { return QVariant(); };
  21.  
  22. private:
  23. int rows, cols;
  24. };
To copy to clipboard, switch view to plain text mode 

and a source file .cpp
Qt Code:
  1. #include <QtGui>
  2. #include <trial.hpp>
  3.  
  4. int main(int argc, char* argv[]) {
  5. Model* model = new Model();
  6. model->setSize(8,6);
  7.  
  8. QVariant *v = new QVariant(QString("Some text"));
  9. if( ! model->setHeaderData(0, Qt::Horizontal, *v) )
  10. qDebug() << "Set hdr failed";
  11.  
  12. v = new QVariant(QString("Some more text"));
  13. QModelIndex mi = model->index(2,4);
  14. if( ! model->setData(mi, *v) )
  15. qDebug() << "Set data failed";
  16. }
To copy to clipboard, switch view to plain text mode 
Any help most welcome,
Enno