diff options
Diffstat (limited to 'src/widgets/itemviews/qlistview.cpp')
-rw-r--r-- | src/widgets/itemviews/qlistview.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 568084640a..04cddf2926 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -54,6 +54,7 @@ #if QT_CONFIG(rubberband) #include <qrubberband.h> #endif +#include <private/qapplication_p.h> #include <private/qlistview_p.h> #include <private/qscrollbar_p.h> #include <qdebug.h> @@ -810,24 +811,24 @@ void QListView::mouseReleaseEvent(QMouseEvent *e) void QListView::wheelEvent(QWheelEvent *e) { Q_D(QListView); - if (e->orientation() == Qt::Vertical) { + if (qAbs(e->angleDelta().y()) > qAbs(e->angleDelta().x())) { if (e->angleDelta().x() == 0 - && ((d->flow == TopToBottom && d->wrap) || (d->flow == LeftToRight && !d->wrap)) - && d->vbar->minimum() == 0 && d->vbar->maximum() == 0) { + && ((d->flow == TopToBottom && d->wrap) || (d->flow == LeftToRight && !d->wrap)) + && d->vbar->minimum() == 0 && d->vbar->maximum() == 0) { QPoint pixelDelta(e->pixelDelta().y(), e->pixelDelta().x()); QPoint angleDelta(e->angleDelta().y(), e->angleDelta().x()); - QWheelEvent hwe(e->pos(), e->globalPos(), pixelDelta, angleDelta, e->delta(), - Qt::Horizontal, e->buttons(), e->modifiers(), e->phase(), e->source(), e->inverted()); + QWheelEvent hwe(e->position(), e->globalPosition(), pixelDelta, angleDelta, + e->buttons(), e->modifiers(), e->phase(), e->inverted(), e->source()); if (e->spontaneous()) qt_sendSpontaneousEvent(d->hbar, &hwe); else - QApplication::sendEvent(d->hbar, &hwe); + QCoreApplication::sendEvent(d->hbar, &hwe); e->setAccepted(hwe.isAccepted()); } else { - QApplication::sendEvent(d->vbar, e); + QCoreApplication::sendEvent(d->vbar, e); } } else { - QApplication::sendEvent(d->hbar, e); + QCoreApplication::sendEvent(d->hbar, e); } } #endif // QT_CONFIG(wheelevent) @@ -1185,7 +1186,7 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie rect.translate(0, -rect.height()); if (rect.bottom() <= 0) { #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { + if (QApplicationPrivate::keypadNavigationEnabled()) { int row = d->batchStartRow() - 1; while (row >= 0 && d->isHiddenOrDisabled(row)) --row; @@ -1214,7 +1215,7 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie rect.translate(0, rect.height()); if (rect.top() >= contents.height()) { #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { + if (QApplicationPrivate::keypadNavigationEnabled()) { int rowCount = d->model->rowCount(d->root); int row = 0; while (row < rowCount && d->isHiddenOrDisabled(row)) |