]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistcontainer.cpp
Fix typo, which caused a Qt runtime warning when closing Dolphin
[dolphin.git] / src / kitemviews / kitemlistcontainer.cpp
index 8ca983acde62a6f047bc7678f051e68bb4aaa70c..58f2e3cd6bcfa25f188d2ab5f0f43b35184a25ce 100644 (file)
@@ -33,6 +33,7 @@
 #include <QPropertyAnimation>
 #include <QScrollBar>
 #include <QStyle>
+#include <QStyleOption>
 
 #include <KDebug>
 
@@ -172,7 +173,7 @@ void KItemListContainer::slotViewChanged(KItemListView* current, KItemListView*
     QGraphicsScene* scene = static_cast<QGraphicsView*>(viewport())->scene();
     if (previous) {
         scene->removeItem(previous);
-        disconnect(current, SIGNAL(scrollOrientationChanged(Qt::Orientation,Qt::Orientation)), this, SLOT(slotScrollOrientationChanged(Qt::Orientation,Qt::Orientation)));
+        disconnect(previous, SIGNAL(scrollOrientationChanged(Qt::Orientation,Qt::Orientation)), this, SLOT(slotScrollOrientationChanged(Qt::Orientation,Qt::Orientation)));
         disconnect(previous, SIGNAL(scrollOffsetChanged(qreal,qreal)),        this, SLOT(updateScrollOffsetScrollBar()));
         disconnect(previous, SIGNAL(maximumScrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar()));
         disconnect(previous, SIGNAL(itemOffsetChanged(qreal,qreal)),          this, SLOT(updateItemOffsetScrollBar()));
@@ -279,13 +280,20 @@ void KItemListContainer::updateGeometries()
 {
     QRect rect = geometry();
 
+    int extra = frameWidth() * 2;
+    QStyleOption option;
+    option.initFrom(this);
+    if (style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &option, this)) {
+        extra += style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &option, this);
+    }
+
     const int widthDec = verticalScrollBar()->isVisible()
-                         ? frameWidth() + style()->pixelMetric(QStyle::PM_ScrollBarExtent)
-                         : frameWidth() * 2;
+                         ? extra + style()->pixelMetric(QStyle::PM_ScrollBarExtent, &option, this)
+                         : extra;
 
     const int heightDec = horizontalScrollBar()->isVisible()
-                          ? frameWidth() + style()->pixelMetric(QStyle::PM_ScrollBarExtent)
-                          : frameWidth() * 2;
+                          ? extra + style()->pixelMetric(QStyle::PM_ScrollBarExtent, &option, this)
+                          : extra;
 
     rect.adjust(0, 0, -widthDec, -heightDec);