#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
-#include <QPropertyAnimation>
#include <QScrollBar>
#include <QStyle>
#include <QStyleOption>
-#include <KDebug>
/**
* Replaces the default viewport of KItemListContainer by a
*/
class KItemListContainerViewport : public QGraphicsView
{
+ Q_OBJECT
+
public:
KItemListContainerViewport(QGraphicsScene* scene, QWidget* parent);
protected:
- virtual void wheelEvent(QWheelEvent* event);
+ void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE;
};
KItemListContainerViewport::KItemListContainerViewport(QGraphicsScene* scene, QWidget* parent) :
KItemListSmoothScroller* smoothScroller = scrollHorizontally ?
m_horizontalSmoothScroller : m_verticalSmoothScroller;
- const int numDegrees = event->delta() / 8;
- const int numSteps = numDegrees / 15;
-
- const QScrollBar* scrollBar = smoothScroller->scrollBar();
- smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 4);
-
- event->accept();
+ smoothScroller->handleWheelEvent(event);
}
void KItemListContainer::slotScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous)
if (view->scrollOrientation() == Qt::Vertical) {
smoothScroller = m_verticalSmoothScroller;
scrollOffsetScrollBar = verticalScrollBar();
- singleStep = view->itemSize().height();
+ singleStep = view->itemSizeHint().height();
// We cannot use view->size().height() because this height might
// include the header widget, which is not part of the scrolled area.
pageStep = view->verticalPageStep();