PDA

View Full Version : extending a selection in a QTableView: painting update problem



Metasequoia
11th November 2010, 22:36
Hello,

I have a QTableView with selectionBehavior set to QAbstractItemView::SelectItems.

When the user is selecting an item, I want the selection to extend to other items on some criterion.
So, I call the .select() method of the QItemSelectionModel of my QTableView with a suitable QItemSelection.
It works, except that the selected items appear one at a time (there is a time lag between each item becoming selected), because the paint() method of the delegate is called successively with each of the QModelIndex contained in the QItemSelection.
What I want to do is to make the items appear as selected at one time: this seems to be a problem of painting update.

If it could be possible to give several indexes to the paint() method of the delegate, the problem would be solved. But this is not the case. As all items are selected at the same time when the selectionBehaviour is set to QAbstractItemView::SelectRows, it is surely possible to solve this problem. I have not been able to understand how it is done in Qt source.

Thanks,

Julien