Hi

I wrote this really long email, and learned a lot about the problem in
doing so.  So, I guess it was time well spent.  Still frustrated. 
Here's the summed up problem:

I have a QAbstrctTabelModel, QSortFilterProxyModel, QItemDelegate, and a
QTableView (all subclassed).  As you'd expect, the QSortFilterProxyModel
filters out what I don't want, the delegate paints what I do, and the
view displays everything.  Some rows are updated, and based on
user-defined criteria, need to be removed *AFTER* the proxy  has let
them in.  Before, I was calling invalidate() in the proxy, but that was
calling filterAcceptsRow() on all rows (visible or not).  Yikes.  So,
I'm now doing removeRows() for the row(s) that must be removed.

Caveat: my subclassed delegate's paint() is being passed a QModelIndex()
with the *old* data.

Example, my rows are.
Harry
Larry
Bob

bool my_proxy::removeRows( int row, int count, const QModelIndex& )
{

    beginRemoveRows( QModelIndex(), row, count + row - 1 );
    // remove data from model here
    endRemoveRows();

}

if I do:
removeRows( 2, 1 );

My model will then show it only has two items.
Harry and Bob

HOWEVER, for the subsequent call to my_delegeate::paint( QPainter*,
const QStyledOptionViewItem& opt, const QModelIndex& index ) will have
the old index.  paint will be called twice, and index.data().toString()
will have Harry for the 1st one, and Larry for the 2nd. 

Am I missing something?
Thanks
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to