VirtualBox

Changeset 100086 in vbox


Ignore:
Timestamp:
Jun 6, 2023 3:15:12 PM (18 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10450: Qt6 compatibility bits for QMouseEvent; Replacing QMouseEvent::globalPos with QSinglePointEvent::globalPosition.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.cpp

    r98103 r100086  
    316316                const int margin = 3;
    317317                QMouseEvent *pMouseEvent = static_cast<QMouseEvent*>(pEvent);
     318#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
     319                const QPoint gPos = pMouseEvent->globalPos();
     320#else
     321                const QPoint gPos = pMouseEvent->globalPosition().toPoint();
     322#endif
    318323                for (int i=1; i < count(); ++i)
    319324                {
     
    323328                    {
    324329                        /* Check if we hit the handle */
    325                         bool fMarginHit = QRect(pHandle->mapToGlobal(QPoint(0, 0)), pHandle->size()).adjusted(-margin, 0, margin, 0).contains(pMouseEvent->globalPos());
     330                        bool fMarginHit = QRect(pHandle->mapToGlobal(QPoint(0, 0)), pHandle->size()).adjusted(-margin, 0, margin, 0).contains(gPos);
    326331                        if (pEvent->type() == QEvent::MouseButtonPress)
    327332                        {
     
    333338                                UICursor::setCursor(this, Qt::SplitHCursor);
    334339                                qApp->postEvent(pHandle, new QMouseEvent(pMouseEvent->type(),
    335                                                                          pHandle->mapFromGlobal(pMouseEvent->globalPos()),
     340                                                                         pHandle->mapFromGlobal(gPos),
    336341                                                                         pMouseEvent->button(),
    337342                                                                         pMouseEvent->buttons(),
     
    349354                                UICursor::setCursor(this, Qt::SplitHCursor);
    350355                                qApp->postEvent(pHandle, new QMouseEvent(pMouseEvent->type(),
    351                                                                          pHandle->mapFromGlobal(pMouseEvent->globalPos()),
     356                                                                         pHandle->mapFromGlobal(gPos),
    352357                                                                         pMouseEvent->button(),
    353358                                                                         pMouseEvent->buttons(),
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBarIndicator.cpp

    r100075 r100086  
    6868    if (pEvent->button() == Qt::LeftButton)
    6969    {
    70         QContextMenuEvent cme(QContextMenuEvent::Mouse, pEvent->pos(), pEvent->globalPos());
     70#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
     71        const QPoint gPos = pEvent->globalPos();
     72#else
     73        const QPoint gPos = pEvent->globalPosition().toPoint();
     74#endif
     75        QContextMenuEvent cme(QContextMenuEvent::Mouse, pEvent->pos(), gPos);
    7176        emit sigContextMenuRequest(this, &cme);
    7277        if (cme.isAccepted())
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp

    r99910 r100086  
    298298        {
    299299            QMouseEvent *pMouseEvent = static_cast<QMouseEvent*>(pEvent);
     300#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
     301            const QPoint gPos = pMouseEvent->globalPos();
     302#else
     303            const QPoint gPos = pMouseEvent->globalPosition().toPoint();
     304#endif
    300305            if (pMouseEvent->buttons() == Qt::LeftButton)
    301306            {
    302307                if (m_previousMousePosition != QPoint(-1, -1))
    303                     emit sigDragging(pMouseEvent->globalPos() - m_previousMousePosition);
    304                 m_previousMousePosition = pMouseEvent->globalPos();
     308                    emit sigDragging(gPos - m_previousMousePosition);
     309                m_previousMousePosition = gPos;
    305310                UICursor::setCursor(m_pDragMoveLabel, Qt::ClosedHandCursor);
    306311            }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp

    r100064 r100086  
    1 /* $Id$ */
     1/* $Id$ */
    22/** @file
    33 * VBox Qt GUI - UIMouseHandler class implementation.
     
    650650                    /* Get mouse-event: */
    651651                    QMouseEvent *pOldMouseEvent = static_cast<QMouseEvent*>(pEvent);
     652#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
     653                    const QPoint gPos = pOldMouseEvent->globalPos();
     654#else
     655                    const QPoint gPos = pOldMouseEvent->globalPosition().toPoint();
     656#endif
    652657
    653658                    /* Check which viewport(s) we *probably* hover: */
     
    655660                    foreach (QWidget *pViewport, m_viewports)
    656661                    {
    657                         QPoint posInViewport = pViewport->mapFromGlobal(pOldMouseEvent->globalPos());
     662                        QPoint posInViewport = pViewport->mapFromGlobal(gPos);
    658663                        if (pViewport->geometry().adjusted(0, 0, 1, 1).contains(posInViewport))
    659664                            probablyHoveredViewports << pViewport;
     
    669674                        /* Prepare redirected mouse-move event: */
    670675                        QMouseEvent *pNewMouseEvent = new QMouseEvent(pOldMouseEvent->type(),
    671                                                                       pHoveredWidget->mapFromGlobal(pOldMouseEvent->globalPos()),
    672                                                                       pOldMouseEvent->globalPos(),
     676                                                                      pHoveredWidget->mapFromGlobal(gPos),
     677                                                                      gPos,
    673678                                                                      pOldMouseEvent->button(),
    674679                                                                      pOldMouseEvent->buttons(),
     
    715720                {
    716721                    QMouseEvent *pMouseEvent = static_cast<QMouseEvent*>(pEvent);
     722#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
     723                    const QPoint gPos = pMouseEvent->globalPos();
     724#else
     725                    const QPoint gPos = pMouseEvent->globalPosition().toPoint();
     726#endif
    717727#ifdef VBOX_WS_NIX
    718728                    /* When the keyboard is captured, we also capture mouse button
     
    732742
    733743                    if (mouseEvent(pMouseEvent->type(), uScreenId,
    734                                    pMouseEvent->pos(), pMouseEvent->globalPos(),
     744                                   pMouseEvent->pos(), gPos,
    735745                                   pMouseEvent->buttons(), 0, Qt::Horizontal))
    736746                        return true;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIStorageSettingsEditor.cpp

    r98103 r100086  
    40404040
    40414041    /* Check whether we should initiate dragging: */
     4042#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
     4043    const QPoint gPos = pEvent->globalPos();
     4044#else
     4045    const QPoint gPos = pEvent->globalPosition().toPoint();
     4046#endif
    40424047    if (   !m_mousePressPosition.isNull()
    4043         && QLineF(pEvent->screenPos(), m_mousePressPosition).length() >= QApplication::startDragDistance())
     4048        && QLineF(gPos, m_mousePressPosition).length() >= QApplication::startDragDistance())
    40444049    {
    40454050        /* Forget last mouse press position: */
     
    40804085    AssertPtrReturnVoid(pEvent);
    40814086
     4087#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
     4088    const QPoint gPos = pEvent->globalPos();
     4089#else
     4090    const QPoint gPos = pEvent->globalPosition().toPoint();
     4091#endif
     4092
    40824093    /* Acquire indexes: */
    40834094    const QModelIndex currentIndex = m_pTreeViewStorage->currentIndex();
     
    40874098    /* Remember last mouse press position only if we pressed current index: */
    40884099    if (index == currentIndex)
    4089         m_mousePressPosition = pEvent->globalPos();
     4100        m_mousePressPosition = gPos;
    40904101
    40914102    /* Expander icon: */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIStatusBarEditorWindow.cpp

    r100075 r100086  
    305305
    306306    /* Remember mouse-press position: */
    307     m_mousePressPosition = pEvent->globalPos();
     307#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
     308    const QPoint gPos = pEvent->globalPos();
     309#else
     310    const QPoint gPos = pEvent->globalPosition().toPoint();
     311#endif
     312    m_mousePressPosition = gPos;
    308313}
    309314
     
    356361
    357362    /* Make sure item is really dragged: */
    358     if (QLineF(pEvent->globalPos(), m_mousePressPosition).length() <
     363#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
     364    const QPoint gPos = pEvent->globalPos();
     365#else
     366    const QPoint gPos = pEvent->globalPosition().toPoint();
     367#endif
     368    if (QLineF(gPos, m_mousePressPosition).length() <
    359369        QApplication::startDragDistance())
    360370        return QWidget::mouseMoveEvent(pEvent);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.cpp

    r100075 r100086  
    546546
    547547    /* Remember mouse-press position: */
     548#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
    548549    m_mousePressPosition = pEvent->globalPos();
     550#else
     551    m_mousePressPosition = pEvent->globalPosition().toPoint();
     552#endif
    549553}
    550554
     
    569573
    570574    /* Make sure item is now being dragged: */
    571     if (QLineF(pEvent->globalPos(), m_mousePressPosition).length() < QApplication::startDragDistance())
     575#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
     576    const QPoint gPos = pEvent->globalPos();
     577#else
     578    const QPoint gPos = pEvent->globalPosition().toPoint();
     579#endif
     580    if (QLineF(gPos, m_mousePressPosition).length() < QApplication::startDragDistance())
    572581        return QWidget::mouseMoveEvent(pEvent);
    573582
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