diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-04-15 09:05:05 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-04-15 12:36:37 (GMT) |
commit | b53f7d4ce3d5d9af47daf78c9f831acc532e688b (patch) | |
tree | da3ab7cf2f7ef794c0cb6db744658f70a75427da /src/gui/itemviews | |
parent | 97caf6916a830b70f6a40a99a55fd4500b163c37 (diff) | |
download | Qt-b53f7d4ce3d5d9af47daf78c9f831acc532e688b.zip Qt-b53f7d4ce3d5d9af47daf78c9f831acc532e688b.tar.gz Qt-b53f7d4ce3d5d9af47daf78c9f831acc532e688b.tar.bz2 |
QListView: Re-fix scrollbar ranges
Commit 11dea4a8b227801c110f791f350632bf6f0c958d fixing QTBUG-2678 was
the wrong solution and introduced some regressions.
Auto-test included.
Reviewed-by: Thierry
Task-number: QTBUG-2678
Task-number: QTBUG-9455
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qlistview.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 39ca75a..1869093 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1853,14 +1853,14 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step) { horizontalScrollBar()->setSingleStep(step.width() + spacing()); horizontalScrollBar()->setPageStep(viewport()->width()); - horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width() - 2 * spacing()); + horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width()); } void QCommonListViewBase::updateVerticalScrollBar(const QSize &step) { verticalScrollBar()->setSingleStep(step.height() + spacing()); verticalScrollBar()->setPageStep(viewport()->height()); - verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height() - 2 * spacing()); + verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height()); } void QCommonListViewBase::scrollContentsBy(int dx, int dy, bool /*scrollElasticBand*/) @@ -2276,6 +2276,7 @@ void QListModeViewBase::doStaticLayout(const QListViewLayoutInfo &info) const QPoint topLeft = initStaticLayout(info); QStyleOptionViewItemV4 option = viewOptions(); option.rect = info.bounds; + option.rect.adjust(info.spacing, info.spacing, -info.spacing, -info.spacing); // The static layout data structures are as follows: // One vector contains the coordinate in the direction of layout flow. @@ -2905,8 +2906,13 @@ void QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo &info) batchStartRow = info.last + 1; bool done = (info.last >= rowCount() - 1); // resize the content area - if (done || !info.bounds.contains(item->rect())) - contentsSize = QSize(rect.width(), rect.height()); + if (done || !info.bounds.contains(item->rect())) { + contentsSize = rect.size(); + if (info.flow == QListView::LeftToRight) + contentsSize.rheight() += info.spacing; + else + contentsSize.rwidth() += info.spacing; + } // resize tree int insertFrom = info.first; if (done || info.first == 0) { |