[Interest] About model/view sorting and headers
Stephen Kelly
stephen.kelly at kdab.com
Wed Mar 21 01:34:57 CET 2012
On Monday, March 05, 2012 17:44:26 Yves Bailly wrote:
> 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?
You're not doing something wrong. You found a bug.
I pushed a fix for review to Qt5 and will backport to Qt 4.8:
http://codereview.qt-project.org/#change,20720
Thanks,
--
Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120321/89dfeaa3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120321/89dfeaa3/attachment.sig>
More information about the Interest
mailing list