[Qt-interest] QSortFilterProxyModel Question

Willy P willy.lists at gmail.com
Mon Sep 21 03:57:55 CEST 2009


I'm trying to understand ProxyModels.  So just to understand what's
going on I've inherited from QSortFilterProxyModel.  I've
re-implemented all the key functions changing nothing except putting a
few qDebugs in there.  For example:

QModelIndex ReducedTreeModel::index( int row, int column, const
QModelIndex& proxyParent ) const
{
		qDebug() << "index" << row << column << proxyParent.internalId();
		return QSortFilterProxyModel::index( row, column, proxyParent );
}

Everything works fine b/c I've modified nothing from the parent class.
 But I'm noticing that the values for QModelIndex::internalId are
crazy.  Is the QSortFilterProxyModel keeping track of data itself?  I
figured the QModelIndices::internalId's would be the same as those for
the actual base model that it's filtering unless I told it otherwise.
I've been reading the docs and making coding attempts all w/e and
there is clearly a very basic concept that I'm missing.  Any help
would be great.

-Willy



More information about the Qt-interest-old mailing list