#include <QPropertyAnimation>
#include <QScrollBar>
#include <QStyle>
+#include <QStyleOption>
#include <KDebug>
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()));
{
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);