diff options
author | Aurélien Gâteau <agateau@kde.org> | 2009-05-17 12:34:35 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-05-28 10:31:42 (GMT) |
commit | d2377967485a9c0ba397bbbab250689b61e529f1 (patch) | |
tree | 167d2795f6b2fc9501d03d8ef8b85302cafc58b0 | |
parent | 218c9883f5b1f7e7eb9e6272460223088bfaf305 (diff) | |
download | Qt-d2377967485a9c0ba397bbbab250689b61e529f1.zip Qt-d2377967485a9c0ba397bbbab250689b61e529f1.tar.gz Qt-d2377967485a9c0ba397bbbab250689b61e529f1.tar.bz2 |
Do not deduce scrollbar extent twice if scrollbar policy is Qt::ScrollBarAlwaysOn
Request-url: http://qt.gitorious.org/qt/qt/merge_requests/432
Reviewed-by: Olivier Goffart
Reviewed-by: Thierry
-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 1071c1d..8b50d0e 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1973,10 +1973,16 @@ void QListViewPrivate::prepareItemsLayout() int frameAroundContents = 0; if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents)) frameAroundContents = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth) * 2; - int verticalMargin = vbarpolicy==Qt::ScrollBarAlwaysOff ? 0 : - q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q->verticalScrollBar()) + frameAroundContents; - int horizontalMargin = hbarpolicy==Qt::ScrollBarAlwaysOff ? 0 : - q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q->horizontalScrollBar()) + frameAroundContents; + + // maximumViewportSize() already takes scrollbar into account if policy is + // Qt::ScrollBarAlwaysOn but scrollbar extent must be deduced if policy + // is Qt::ScrollBarAsNeeded + int verticalMargin = vbarpolicy==Qt::ScrollBarAsNeeded + ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q->verticalScrollBar()) + frameAroundContents + : 0; + int horizontalMargin = hbarpolicy==Qt::ScrollBarAsNeeded + ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q->horizontalScrollBar()) + frameAroundContents + : 0; layoutBounds.adjust(0, 0, -verticalMargin, -horizontalMargin); |