From: Yichao Yu Date: Mon, 18 Nov 2013 22:40:40 +0000 (+0100) Subject: Fix scrollbar spacing when no scrollbar is visible in dolphin. X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/c89cd8e789743fbf437ea1971067511c6c57756d Fix scrollbar spacing when no scrollbar is visible in dolphin. Before this commit, Dolphin reserved space for the scrollbar spacing even when no scrollbar is visible resulting in a ugly gap in the view when: 1. the theme uses QStyle::SH_ScrollView_FrameOnlyAroundContents and 2. the theme has a positive PM_ScrollView_ScrollBarSpacing. QtCurve can have both while Oxygen have 1 but not 2. To reproduce the problem with Oxygen style. Replace the `width += ....` (which returns -2 or 0 for Oxygen) with `width += 2`. See more info here: https://github.com/QtCurve/qtcurve-qt4/issues/9#issuecomment-28630517 CCBUG: 306631 FIXED-IN: 4.11.4 REVIEW: 113902 --- diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index f2e94b733..cd2fca1e1 100644 --- a/src/kitemviews/kitemlistcontainer.cpp +++ b/src/kitemviews/kitemlistcontainer.cpp @@ -338,16 +338,17 @@ void KItemListContainer::updateGeometries() int extra = frameWidth() * 2; QStyleOption option; option.initFrom(this); + int scrollbarSpacing = 0; if (style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &option, this)) { - extra += style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &option, this); + scrollbarSpacing = style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &option, this); } const int widthDec = verticalScrollBar()->isVisible() - ? extra + style()->pixelMetric(QStyle::PM_ScrollBarExtent, &option, this) + ? extra + scrollbarSpacing + style()->pixelMetric(QStyle::PM_ScrollBarExtent, &option, this) : extra; const int heightDec = horizontalScrollBar()->isVisible() - ? extra + style()->pixelMetric(QStyle::PM_ScrollBarExtent, &option, this) + ? extra + scrollbarSpacing + style()->pixelMetric(QStyle::PM_ScrollBarExtent, &option, this) : extra; rect.adjust(0, 0, -widthDec, -heightDec);