VirtualBox

Changeset 94024 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 1, 2022 10:47:31 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: qt6: QWheelEvent has dropped qt4 compatibility stuff like orientation(), delta(), pos(), globalPos(). The posF() and globalPosF() functions have been renamed position() and globalPosition(). The orientation() and delta() was replaced by pixelDelta and angelDelta in qt 5.0. We probably should use the latter, but I opted for the former as that maps better to the code. Someone else can try bring it up to qt5/6 standards. bugref:9898

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp

    r94013 r94024  
    758758                     * guest mouse device at all: */
    759759                    int iDelta = 0;
     760#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     761                    Qt::Orientation const enmOrientation = RT_ABS(pWheelEvent->pixelDelta().x())
     762                                                         > RT_ABS(pWheelEvent->pixelDelta().y()) ? Qt::Horizontal : Qt::Vertical;
     763                    m_iLastMouseWheelDelta += enmOrientation == Qt::Horizontal
     764                                            ? pWheelEvent->pixelDelta().x() : pWheelEvent->pixelDelta().y();
     765#else
    760766                    m_iLastMouseWheelDelta += pWheelEvent->delta();
     767#endif
    761768                    if (qAbs(m_iLastMouseWheelDelta) >= 120)
    762769                    {
     
    767774                    }
    768775                    if (mouseEvent(pWheelEvent->type(), uScreenId,
     776#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) /** @todo .... */
     777                                   pWheelEvent->position().toPoint(), pWheelEvent->globalPosition().toPoint(),
     778#else
    769779                                   pWheelEvent->pos(), pWheelEvent->globalPos(),
     780#endif
    770781#ifdef VBOX_WS_MAC
    771782                                   /* Qt Cocoa is buggy. It always reports a left button pressed when the
     
    776787                                   pWheelEvent->buttons(),
    777788#endif /* !VBOX_WS_MAC */
    778                                    iDelta, pWheelEvent->orientation()))
     789                                   iDelta,
     790#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     791                                   enmOrientation)
     792#else
     793                                   pWheelEvent->orientation())
     794#endif
     795                                   )
    779796                        return true;
    780797                    break;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette