FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Replace deprecated QWheelEvent::delta() method · GCodeProjects/GCodeWorkShop@ad9bc0a · GitHub

Commit ad9bc0a

Browse files
committed
Replace deprecated QWheelEvent::delta() method
1 parent 8033cec commit ad9bc0a

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎3rdparty/kdiff3/mergeresultwindow.cpp‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <QTextStream>
2626
#include <QKeyEvent>
2727
#include <QMouseEvent>
28+
#include <QPoint>
2829

2930
#include <QLineEdit>
3031
#include <QTextCodec>
@@ -2260,9 +2261,14 @@ void MergeResultWindow::slotCursorUpdate()
22602261

22612262
void MergeResultWindow::wheelEvent(QWheelEvent *e)
22622263
{
2263-
int d = -e->delta() * QApplication::wheelScrollLines() / 120;
2264+
QPoint d = e->pixelDelta();
2265+
2266+
if (d.isNull()) {
2267+
d = - e->angleDelta() / 120 * QApplication::wheelScrollLines();
2268+
}
2269+
22642270
e->accept();
2265-
scroll(0, min2(d, getNofVisibleLines()));
2271+
scroll(d.x(), min2(d.y(), getNofVisibleLines()));
22662272
}
22672273

22682274

‎3rdparty/kdiff3/pdiff.cpp‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <qcombobox.h>
3131
#include <QDropEvent>
3232
#include <QUrl>
33+
#include <QPoint>
3334
#include <QProcess>
3435

3536
#include <assert.h>
@@ -783,12 +784,13 @@ bool KDiff3App::eventFilter(QObject *o, QEvent *e)
783784
QWheelEvent *w = (QWheelEvent *)e;
784785
w->accept();
785786

786-
int deltaX = 0;
787+
QPoint d = w->pixelDelta();
787788

788-
int d = w->delta();
789-
int deltaY = -d / 120 * QApplication::wheelScrollLines();
789+
if (d.isNull()) {
790+
d = - w->angleDelta() / 120 * QApplication::wheelScrollLines();
791+
}
790792

791-
scrollDiffTextWindow(deltaX, deltaY);
793+
scrollDiffTextWindow(d.x(), d.y());
792794
return true;
793795
} else if (e->type() == QEvent::Drop) {
794796
QDropEvent *pDropEvent = static_cast<QDropEvent *>(e);

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL