Changeset 97857 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Dec 23, 2022 2:28:37 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r97849 r97857 27 27 28 28 /* Qt includes: */ 29 #include <QtMath> 29 30 #include <QMouseEvent> 30 31 #include <QTimer> … … 770 771 * guest mouse device at all: */ 771 772 int iDelta = 0; 772 #ifdef VBOX_IS_QT6_OR_LATER 773 Qt::Orientation const enmOrientation = RT_ABS(pWheelEvent->pixelDelta().x()) 774 > RT_ABS(pWheelEvent->pixelDelta().y()) ? Qt::Horizontal : Qt::Vertical; 773 const Qt::Orientation enmOrientation = qFabs(pWheelEvent->angleDelta().x()) 774 > qFabs(pWheelEvent->angleDelta().y()) 775 ? Qt::Horizontal 776 : Qt::Vertical; 775 777 m_iLastMouseWheelDelta += enmOrientation == Qt::Horizontal 776 ? pWheelEvent->pixelDelta().x() : pWheelEvent->pixelDelta().y(); 777 #else 778 m_iLastMouseWheelDelta += pWheelEvent->delta(); 779 #endif 778 ? pWheelEvent->angleDelta().x() 779 : pWheelEvent->angleDelta().y(); 780 780 if (qAbs(m_iLastMouseWheelDelta) >= 120) 781 781 { … … 785 785 m_iLastMouseWheelDelta = m_iLastMouseWheelDelta % 120; 786 786 } 787 if (mouseEvent(pWheelEvent->type(), uScreenId, 788 #ifdef VBOX_IS_QT6_OR_LATER 789 pWheelEvent->position().toPoint(), pWheelEvent->globalPosition().toPoint(), 787 if (mouseEvent(pWheelEvent->type(), 788 uScreenId, 789 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) 790 pWheelEvent->position().toPoint(), 790 791 #else 791 pWheelEvent->pos() , pWheelEvent->globalPos(),792 pWheelEvent->pos() 792 793 #endif 794 pWheelEvent->globalPosition().toPoint(), 793 795 #ifdef VBOX_WS_MAC 794 /* Qt Cocoa is buggy. It always reports a left button pressed when the 795 * mouse wheel event occurs. A workaround is to ask the application which 796 * buttons are pressed currently: */ 796 // WORKAROUND: 797 // Qt Cocoa is buggy. It always reports a left button pressed when the 798 // mouse wheel event occurs. A workaround is to ask the application which 799 // buttons are pressed currently: 797 800 QApplication::mouseButtons(), 798 801 #else /* !VBOX_WS_MAC */ … … 800 803 #endif /* !VBOX_WS_MAC */ 801 804 iDelta, 802 #ifdef VBOX_IS_QT6_OR_LATER803 805 enmOrientation) 804 #else805 pWheelEvent->orientation())806 #endif807 806 ) 808 807 return true;
Note:
See TracChangeset
for help on using the changeset viewer.