Priority: P3: Somewhat important
Affects Version/s: 5.7.0
Fix Version/s: None
Component/s: Widgets: Itemviews
When dataChanged() is emitted with indexes indicating a range, then the whole viewport will be updated as the range is not taken into consideration. If only a single index is covered by the "range" indicated in the emitted signal then it only updates that index.
Attached is an example that reproduces the problem, the signal is emitted with only rows 2-3 in the range yet all of the rows are updated.
I have seen this problem QTreeView, it may happen with other view classes as well.
This seems grossly inefficient.
This could probably be fixed by forming a rectangle containing the begin and end elements of the range, and invalidating that rectangle.
( Modified from bug report https://bugreports.qt.io/browse/QTBUG-13668 )
The guilty code is in QAbstractItemView::dataChanged(),
where an if branch on 'topLeft == bottomRight' is done.
If false, d->viewport->update() is called.