#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:
const QScrollBar* scrollBar = smoothScroller->scrollBar();
if (!event->pixelDelta().isNull()) {
const int numPixels = event->pixelDelta().y();
- smoothScroller->scrollTo(scrollBar->value() - numPixels);
+ if (event->modifiers().testFlag(Qt::ShiftModifier)) {
+ const int scrollingDirection = numPixels > 0 ? 1 : -1;
+ smoothScroller->scrollTo(scrollBar->value() - scrollBar->pageStep() * scrollingDirection);
+ } else {
+ 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);
+ const int numSteps = qApp->wheelScrollLines() * numDegrees / 15;
+ if (event->modifiers().testFlag(Qt::ShiftModifier)) {
+ const int scrollingDirection = numSteps > 0 ? 1 : -1;
+ smoothScroller->scrollTo(scrollBar->value() - scrollBar->pageStep() * scrollingDirection);
+ } else {
+ smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 12);
+ }
}
event->accept();
}
}
+#include "kitemlistcontainer.moc"