scroll horizontally when the scroll is vertical and there was no space to scroll vertically

and vice versa for horizontal scroll

svn path=/trunk/KDE/kdelibs/; revision=1106404
This commit is contained in:
Marco Martin 2010-03-22 18:36:57 +00:00
parent a0fe64f519
commit 07ad834e81

View File

@ -644,7 +644,6 @@ public:
QPointF start = widget.data()->pos(); QPointF start = widget.data()->pos();
QPointF end = start; QPointF end = start;
qreal step = event->delta()/3;
//At some point we should switch to //At some point we should switch to
// step = QApplication::wheelScrollLines() * // step = QApplication::wheelScrollLines() *
@ -654,13 +653,27 @@ public:
// is that at this point we don't have any clue what a "line" is and if // is that at this point we don't have any clue what a "line" is and if
// we make it a pixel then scrolling by 3 (default) pixels will be // we make it a pixel then scrolling by 3 (default) pixels will be
// very painful // very painful
if(event->orientation() == Qt::Vertical) { qreal step = event->delta()/3;
//ifthe widget can scroll in a single axis and the wheel is the other one, scroll the other one
Qt::Orientation orientation = event->orientation();
if (orientation == Qt::Vertical) {
if (!canYFlick() && canXFlick()) {
end += QPointF(step, 0);
} else if (canYFlick()) {
end += QPointF(0, step); end += QPointF(0, step);
} else if (event->orientation() == Qt::Horizontal) { } else {
return;
}
} else {
if (canYFlick() && !canXFlick()) {
end += QPointF(0, step);
} else if (canXFlick()) {
end += QPointF(step, 0); end += QPointF(step, 0);
} else { } else {
return; return;
} }
}
directMoveAnimation->setStartValue(start); directMoveAnimation->setStartValue(start);
directMoveAnimation->setEndValue(end); directMoveAnimation->setEndValue(end);