Can I add columns in a QListView in Qt ??
Posted
by
Vic.
on Stack Overflow
See other posts from Stack Overflow
or by Vic.
Published on 2010-12-22T06:48:53Z
Indexed on
2010/12/22
6:54 UTC
Read the original article
Hit count: 235
Can I add columns in a QListView object??
here's something I found here:
model->setHeaderData( 0, Qt::Horizontal, "numéro" );
model->setHeaderData( 1, Qt::Horizontal, "prénom" );
model->setHeaderData( 2, Qt::Horizontal, "nom" );
//...
model->setData( model->index( line, 0 ), contact->num(), Qt::DisplayRole );
model->setData( model->index( line, 1 ), contact->prenom(), Qt::DisplayRole );
model->setData( model->index( line, 2 ), contact->nom(), Qt::DisplayRole );
Since I'm using Qt Creator 2.0.1, I figured my model would be:
ui->ObjectName->model()
The application builds successfully but I get a: "The program has unexpectedly finished." at runtime.
Any Ideas ? Thanks.
© Stack Overflow or respective owner