[Interest] About model/view sorting and headers

Yves Bailly yves.bailly at sescoi.fr
Mon Mar 5 17:44:26 CET 2012


Le 05/03/2012 15:58, Jason H a écrit :
> It would seem as your row header isn't header, but data?

Not sure about this... I fill my headers with code like this, in
the loop which appends rows:

// in the following, "this" is a subclass of QStandardItemModel
QList<QStandardItem*> row;
// ...filling row items...
this->appendRow(row);
QStandardItem* row_header = this->verticalHeaderItem(this->rowCount()-1);
if ( row_header == nullptr )
{
   row_header = new QStandardItem();
   this->setVerticalHeaderItem(this->rowCount()-1, row_header);
}
row_header->setText(QString("rec_%1").arg(this->rowCount());

Is this wrong? should I set the rows' headers in another way?

-- 
      /- Yves Bailly - Software developper  -\
      \- Sescoi R&D  - http://www.sescoi.fr -/
"The possible is done. The impossible is being done. For miracles,
thanks to allow a little delay."



More information about the Interest mailing list