diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-19 15:24:10 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-11-21 04:36:06 (GMT) |
commit | fb65db54eb502f773eaa402e3aabfada585c4fd6 (patch) | |
tree | 28714be5fae987a8536acc43ab942eb97a3e1359 /src | |
parent | b1d66180464448bfd473049b55a7640d3a817022 (diff) | |
download | Qt-fb65db54eb502f773eaa402e3aabfada585c4fd6.zip Qt-fb65db54eb502f773eaa402e3aabfada585c4fd6.tar.gz Qt-fb65db54eb502f773eaa402e3aabfada585c4fd6.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
(cherry picked from commit 73153fa5288e22d27f26d0e1045e82698c9a6343)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/itemviews/qlistview.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 2abc354..6fa4b17 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)) |