summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-19 15:24:10 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-19 15:24:10 (GMT)
commit73153fa5288e22d27f26d0e1045e82698c9a6343 (patch)
tree8854f76df30df98436a492d5adc9f16c47f88a48 /src/gui/itemviews
parentc48ba6b516b46775439dc3c86b21bf9ce9c7f23a (diff)
downloadQt-73153fa5288e22d27f26d0e1045e82698c9a6343.zip
Qt-73153fa5288e22d27f26d0e1045e82698c9a6343.tar.gz
Qt-73153fa5288e22d27f26d0e1045e82698c9a6343.tar.bz2
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
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qlistview.cpp8
1 files 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<QModelIndex>::const_iterator end = toBeRendered.constEnd();
for (QVector<QModelIndex>::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))