From 73153fa5288e22d27f26d0e1045e82698c9a6343 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 19 Nov 2009 16:24:10 +0100 Subject: Fixes regression in QListView: Selection would not expend to the full viewport Commit ecc202c introduced the regression while fixing another regression (QTBUG-5854) The selection would not expend to the whole viewport. Reviewed-by: Robert Griebl --- src/gui/itemviews/qlistview.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 052308c..d03cdd3 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -966,15 +966,19 @@ void QListView::paintEvent(QPaintEvent *e) bool alternateBase = false; int previousRow = -2; // trigger the alternateBase adjustment on first pass + int maxSize = (flow() == TopToBottom) + ? qMax(viewport()->size().width(), d->contentsSize().width()) - 2 * d->spacing() + : qMax(viewport()->size().height(), d->contentsSize().height()) - 2 * d->spacing(); + QVector::const_iterator end = toBeRendered.constEnd(); for (QVector::const_iterator it = toBeRendered.constBegin(); it != end; ++it) { Q_ASSERT((*it).isValid()); option.rect = visualRect(*it); if (flow() == TopToBottom) - option.rect.setWidth(qMin(d->contentsSize().width() - 2 * d->spacing(), option.rect.width())); + option.rect.setWidth(qMin(maxSize, option.rect.width())); else - option.rect.setHeight(qMin(d->contentsSize().height() - 2 * d->spacing(), option.rect.height())); + option.rect.setHeight(qMin(maxSize, option.rect.height())); option.state = state; if (selections && selections->isSelected(*it)) -- cgit v0.12