QColumnView: re-enable scrolling of the preview widget

For some reason, each column in a QColumnView is a QAbstractItemView,
*including* the preview widget's column. Unfortunately,
the preview widget's column class was not overriding scrollContentsBy,
so scrolling it had no effect.

A more comprehensive solution would be a major refactoring of the
code to make that column a plain Q(Abstract)ScrollArea, as it doesn't
need QAIV's APIs at all, but I don't want to change code and risk
breaking behavior.

Change-Id: Ice500a8eaef13c295df4cc274b9f80d9a24c65f4
Task-number: QTBUG-11392
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
This commit is contained in:
Giuseppe D'Angelo 2015-05-06 14:02:48 +02:00
parent e374ffc29c
commit ea17cc0768

View File

@ -89,6 +89,16 @@ public:
QAbstractScrollArea::resizeEvent(event);
}
void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE
{
if (!previewWidget)
return;
scrollDirtyRegion(dx, dy);
viewport()->scroll(dx, dy);
QAbstractItemView::scrollContentsBy(dx, dy);
}
QRect visualRect(const QModelIndex &) const Q_DECL_OVERRIDE
{
return QRect();