]> git.pld-linux.org Git - packages/qt4.git/blob - 0283-do-not-deduce-scrollbar-extent-twice.diff
- up to 4.5.2
[packages/qt4.git] / 0283-do-not-deduce-scrollbar-extent-twice.diff
1 qt-bugs@ issue : none
2 Qt Software task ID : none
3 bugs.kde.org number : none
4 applied: no
5 author: Aurélien Gâteau <agateau@kde.org>
6
7 Do not deduce scrollbar extent twice if scrollbar policy is
8 Qt::ScrollBarAlwaysOn.
9
10 This patch has been merged in master but won't be in 4.5.
11 http://qt.gitorious.org/qt/qt/merge_requests/432
12
13 --- src/gui/itemviews/qlistview.cpp
14 +++ src/gui/itemviews/qlistview.cpp
15 @@ -1969,10 +1969,16 @@ void QListViewPrivate::prepareItemsLayout()
16      int frameAroundContents = 0;
17      if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents))
18          frameAroundContents = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth) * 2;
19 -    int verticalMargin = vbarpolicy==Qt::ScrollBarAlwaysOff ? 0 :
20 -        q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q->verticalScrollBar()) + frameAroundContents;
21 -    int horizontalMargin =  hbarpolicy==Qt::ScrollBarAlwaysOff ? 0 :
22 -        q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q->horizontalScrollBar()) + frameAroundContents;
23 +
24 +    // maximumViewportSize() already takes scrollbar into account if policy is
25 +    // Qt::ScrollBarAlwaysOn but scrollbar extent must be deduced if policy
26 +    // is Qt::ScrollBarAsNeeded
27 +    int verticalMargin = vbarpolicy==Qt::ScrollBarAsNeeded
28 +        ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q->verticalScrollBar()) + frameAroundContents
29 +        : 0;
30 +    int horizontalMargin =  hbarpolicy==Qt::ScrollBarAsNeeded
31 +        ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q->horizontalScrollBar()) + frameAroundContents
32 +        : 0;
33  
34      layoutBounds.adjust(0, 0, -verticalMargin, -horizontalMargin);
35  
This page took 0.029436 seconds and 3 git commands to generate.