Update QWheelEvent delta usage

This commit is contained in:
Luis Ángel San Martín 2021-10-01 20:07:14 +02:00
parent 1c144d950d
commit 740eab5025
3 changed files with 10 additions and 10 deletions

View File

@ -195,7 +195,7 @@ void GoToFlow::updateImageData()
void GoToFlow::wheelEvent(QWheelEvent *event)
{
if (event->delta() < 0)
if (event->pixelDelta().y() < 0)
flow->showNext();
else
flow->showPrevious();

View File

@ -144,28 +144,28 @@ void MagnifyingGlass::wheelEvent(QWheelEvent *event)
switch (event->modifiers()) {
// size
case Qt::NoModifier:
if (event->delta() < 0)
if (event->pixelDelta().y() < 0)
sizeUp();
else
sizeDown();
break;
// size height
case Qt::ControlModifier:
if (event->delta() < 0)
if (event->pixelDelta().y() < 0)
heightUp();
else
heightDown();
break;
// size width
case Qt::AltModifier:
if (event->delta() < 0)
if (event->pixelDelta().y() < 0)
widthUp();
else
widthDown();
break;
// zoom level
case Qt::ShiftModifier:
if (event->delta() < 0)
if (event->pixelDelta().y() < 0)
zoomIn();
else
zoomOut();

View File

@ -689,12 +689,12 @@ static void animateScroll(QPropertyAnimation &scroller, const QScrollBar &scroll
void Viewer::wheelEvent(QWheelEvent *event)
{
if (render->hasLoadedComic()) {
if (event->orientation() == Qt::Horizontal) {
animateScroll(*horizontalScroller, *horizontalScrollBar(), event->delta());
if (event->pixelDelta().x() != 0) {
animateScroll(*horizontalScroller, *horizontalScrollBar(), event->pixelDelta().x());
return;
}
if ((event->delta() < 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->maximum())) {
if ((event->pixelDelta().y() < 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->maximum())) {
if (wheelStop || verticalScrollBar()->maximum() == verticalScrollBar()->minimum()) {
if (getMovement(event) == Forward) {
next();
@ -706,7 +706,7 @@ void Viewer::wheelEvent(QWheelEvent *event)
} else
wheelStop = true;
} else {
if ((event->delta() > 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->minimum())) {
if ((event->pixelDelta().y() > 0) && (verticalScrollBar()->sliderPosition() == verticalScrollBar()->minimum())) {
if (wheelStop || verticalScrollBar()->maximum() == verticalScrollBar()->minimum()) {
if (getMovement(event) == Backward) {
prev();
@ -720,7 +720,7 @@ void Viewer::wheelEvent(QWheelEvent *event)
}
}
animateScroll(*verticalScroller, *verticalScrollBar(), event->delta());
animateScroll(*verticalScroller, *verticalScrollBar(), event->pixelDelta().y());
}
}