#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:
KItemListSmoothScroller* smoothScroller = scrollHorizontally ?
m_horizontalSmoothScroller : m_verticalSmoothScroller;
- const QScrollBar* scrollBar = smoothScroller->scrollBar();
- if (!event->pixelDelta().isNull()) {
- const int numPixels = event->pixelDelta().y();
- smoothScroller->scrollTo(scrollBar->value() - numPixels);
- } else {
- const int numDegrees = event->angleDelta().y() / 8;
- const int numSteps = numDegrees / 15;
- smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 4);
- }
-
- event->accept();
+ smoothScroller->handleWheelEvent(event);
}
void KItemListContainer::slotScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous)
}
}
+#include "kitemlistcontainer.moc"