[Interest] mapping headerData to a source model

Paul England pengland at cmt-asia.com
Thu Nov 15 06:36:00 CET 2012

Okay, after writing a small example I think I'm grasping how
model->proxy->delegate->view all operate together.  Hoewver, I have
found a single caveat that I haven't been able to figure out:

For my QSortFilterProxyModel, I'm using mapToSource( const QModelIndex&
) to magically get the "real" index back from the model.  However, I
don't see anything similar corresponding to headerData().  The result
is, if I have columns 0-4 in a QTableView, and then block column 2 with
QSortFilterProxyModel::filterAcceptsColumn(), my data in the cells is
displayed properly.  However, the headers will now say 0,1,2,3 intstead
of 0,1,3,4.

I feel I'm missing something rather easy here.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121115/5a93f510/attachment.html>

More information about the Interest mailing list