Hello.
I try to write QAbstractTableModel but i have problem with index.
My test class:
Qt Code:
  1. class cmodel : public QAbstractTableModel
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. cmodel( QObject *parent = 0);
  7. ~cmodel();
  8.  
  9. QVariant data(const QModelIndex &index, int role) const;
  10. bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole);
  11. int rowCount(const QModelIndex &parent) const;
  12. int columnCount(const QModelIndex &parent) const;
  13. QVariant headerData(int section, Qt::Orientation orientation, int role) const;
  14. Qt::ItemFlags flags(const QModelIndex &index) const;
  15.  
  16. private:
  17. QStringList listaStr, listaUrl;
  18. };
To copy to clipboard, switch view to plain text mode 
and function
Qt Code:
  1. void MainWindow::on_pushButton_clicked()
  2. {
  3. str << "1" << "2" << "3";
  4. cmodel *m = new cmodel( this );
  5. QModelIndex index = m->index( 0, 0, QModelIndex() );
  6. m->setData( index, str, Qt::DisplayRole );
  7. ui->tableView->setModel( m );
  8. }
To copy to clipboard, switch view to plain text mode 

but in setData my index is invalid ( index.isValid() is false ).
Why is that?

Thanks for any suggestion and sorry for my "enrgish"
best regards