VirtualBox

Changeset 100344 in vbox


Ignore:
Timestamp:
Jul 3, 2023 10:09:28 AM (17 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10450: Qt6 compatibility bits for QMouseEvent; Replacing QMouseEvent::pos with QSinglePointEvent::position; S.a. r157776.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/overview/UIVMActivityOverviewWidget.cpp

    r98103 r100344  
    760760void UIVMActivityOverviewTableView::mousePressEvent(QMouseEvent *pEvent)
    761761{
     762#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    762763    if (!indexAt(pEvent->pos()).isValid())
     764#else
     765    if (!indexAt(pEvent->position().toPoint()).isValid())
     766#endif
    763767        clearSelection();
    764768    QTableView::mousePressEvent(pEvent);
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.cpp

    r98103 r100344  
    169169{
    170170    /* Start dragging: */
     171#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    171172    if (pEvent->button() == Qt::LeftButton && geometry().contains(pEvent->pos()) && m_fFullSizeSelection)
     173#else
     174    if (pEvent->button() == Qt::LeftButton && geometry().contains(pEvent->position().toPoint()) && m_fFullSizeSelection)
     175#endif
    172176        m_fStartDragging = true;
    173177    /* Call to base-class: */
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBarIndicator.cpp

    r100086 r100344  
    6969    {
    7070#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
    71         const QPoint gPos = pEvent->globalPos();
     71        QContextMenuEvent cme(QContextMenuEvent::Mouse, pEvent->pos(), pEvent->globalPos());
    7272#else
    73         const QPoint gPos = pEvent->globalPosition().toPoint();
     73        QContextMenuEvent cme(QContextMenuEvent::Mouse, pEvent->position().toPoint(), pEvent->globalPosition().toPoint());
    7474#endif
    75         QContextMenuEvent cme(QContextMenuEvent::Mouse, pEvent->pos(), gPos);
    7675        emit sigContextMenuRequest(this, &cme);
    7776        if (cme.isAccepted())
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r100064 r100344  
    459459void UIBookmarksListWidget::mousePressEvent(QMouseEvent *pEvent)
    460460{
     461#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    461462    if (!indexAt(pEvent->pos()).isValid())
     463#else
     464    if (!indexAt(pEvent->position().toPoint()).isValid())
     465#endif
    462466    {
    463467        clearSelection();
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp

    r100108 r100344  
    681681    if (fOverlayMode)
    682682        return;
     683#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    683684    QString strAnchor = anchorAt(pEvent->pos());
     685#else
     686    QString strAnchor = anchorAt(pEvent->position().toPoint());
     687#endif
    684688
    685689    if (!strAnchor.isEmpty())
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerTextEdit.cpp

    r98103 r100344  
    180180{
    181181    if (m_pTextEdit)
     182#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    182183        m_pTextEdit->setMouseCursorLine(m_pTextEdit->lineNumberForPos(pEvent->pos()));
     184#else
     185        m_pTextEdit->setMouseCursorLine(m_pTextEdit->lineNumberForPos(pEvent->position().toPoint()));
     186#endif
    183187    update();
    184188}
     
    187191{
    188192    if (m_pTextEdit)
     193#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    189194        m_pTextEdit->toggleBookmark(m_pTextEdit->bookmarkForPos(pEvent->pos()));
     195#else
     196        m_pTextEdit->toggleBookmark(m_pTextEdit->bookmarkForPos(pEvent->position().toPoint()));
     197#endif
    190198}
    191199
     
    388396void UIVMLogViewerTextEdit::mouseMoveEvent(QMouseEvent *pEvent)
    389397{
     398#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    390399    setMouseCursorLine(lineNumberForPos(pEvent->pos()));
     400#else
     401    setMouseCursorLine(lineNumberForPos(pEvent->position().toPoint()));
     402#endif
    391403    if (m_pLineNumberArea)
    392404        m_pLineNumberArea->update();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r100064 r100344  
    20112011    {
    20122012        /* Get mouse-pointer location. */
     2013#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    20132014        const QPoint &cpnt = viewportToContents(pEvent->pos());
     2015#else
     2016        const QPoint &cpnt = viewportToContents(pEvent->position().toPoint());
     2017#endif
    20142018
    20152019        /* Ask the target for starting a DnD event. */
     
    20372041    {
    20382042        /* Get mouse-pointer location. */
     2043#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    20392044        const QPoint &cpnt = viewportToContents(pEvent->pos());
     2045#else
     2046        const QPoint &cpnt = viewportToContents(pEvent->position().toPoint());
     2047#endif
    20402048
    20412049        /* Ask the guest for moving the drop cursor. */
     
    20782086    {
    20792087        /* Get mouse-pointer location. */
     2088#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    20802089        const QPoint &cpnt = viewportToContents(pEvent->pos());
     2090#else
     2091        const QPoint &cpnt = viewportToContents(pEvent->position().toPoint());
     2092#endif
    20812093
    20822094        /* Ask the guest for dropping data. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp

    r100086 r100344  
    720720                {
    721721                    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
    727722#ifdef VBOX_WS_NIX
    728723                    /* When the keyboard is captured, we also capture mouse button
     
    741736                        m_iLastMouseWheelDelta = 0;
    742737
     738#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
    743739                    if (mouseEvent(pMouseEvent->type(), uScreenId,
    744                                    pMouseEvent->pos(), gPos,
     740                                   pMouseEvent->pos(), pMouseEvent->globalPos(),
    745741                                   pMouseEvent->buttons(), 0, Qt::Horizontal))
     742#else
     743                    if (mouseEvent(pMouseEvent->type(), uScreenId,
     744                                   pMouseEvent->position().toPoint(), pMouseEvent->globalPosition().toPoint(),
     745                                   pMouseEvent->buttons(), 0, Qt::Horizontal))
     746#endif
    746747                        return true;
    747748                    break;
     
    12531254        {
    12541255            /* Get absolute touch-point origin: */
     1256#ifndef VBOX_IS_QT6_OR_LATER /* QEventPoint::pos was replaced with QEventPoint::position in Qt6 */
    12551257            QPoint currentTouchPoint = touchPoint.pos().toPoint();
     1258#else
     1259            QPoint currentTouchPoint = touchPoint.position().toPoint();
     1260#endif
    12561261
    12571262            /* Pass absolute touch-point data: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIStorageSettingsEditor.cpp

    r100154 r100344  
    39543954    /* Make sure event is valid: */
    39553955    AssertPtrReturnVoid(pEvent);
    3956 
    3957     const QModelIndex index = m_pTreeViewStorage->indexAt(pEvent->pos());
     3956#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
     3957    const QPoint gPos = pEvent->globalPos();
     3958    const QPoint lPos = pEvent->pos();
     3959#else
     3960    const QPoint gPos = pEvent->globalPosition().toPoint();
     3961    const QPoint lPos = pEvent->position().toPoint();
     3962#endif
     3963
     3964    const QModelIndex index = m_pTreeViewStorage->indexAt(lPos);
    39583965    const QRect indexRect = m_pTreeViewStorage->visualRect(index);
    39593966
     
    39633970        QRect expanderRect = m_pModelStorage->data(index, StorageModel::R_ItemPixmapRect).toRect();
    39643971        expanderRect.translate(indexRect.x(), indexRect.y());
    3965         if (expanderRect.contains(pEvent->pos()))
     3972        if (expanderRect.contains(lPos))
    39663973        {
    39673974            pEvent->setAccepted(true);
     
    40044011            deviceRect.translate(indexRect.x() + indexRect.width(), indexRect.y());
    40054012
    4006             if (deviceRect.contains(pEvent->pos()))
     4013            if (deviceRect.contains(lPos))
    40074014            {
    40084015                pEvent->setAccepted(true);
     
    40404047
    40414048    /* 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
    40474049    if (   !m_mousePressPosition.isNull()
    40484050        && QLineF(gPos, m_mousePressPosition).length() >= QApplication::startDragDistance())
     
    40524054
    40534055        /* Check what item we are hovering currently: */
    4054         QModelIndex index = m_pTreeViewStorage->indexAt(pEvent->pos());
     4056        QModelIndex index = m_pTreeViewStorage->indexAt(lPos);
    40554057        AbstractItem *pItem = static_cast<AbstractItem*>(index.internalPointer());
    40564058        /* And make sure this is attachment item, we are supporting dragging for this kind only: */
     
    40844086    /* Make sure event is valid: */
    40854087    AssertPtrReturnVoid(pEvent);
    4086 
    40874088#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::globalPos was replaced with QSinglePointEvent::globalPosition in Qt6 */
    40884089    const QPoint gPos = pEvent->globalPos();
     4090    const QPoint lPos = pEvent->pos();
    40894091#else
    40904092    const QPoint gPos = pEvent->globalPosition().toPoint();
     4093    const QPoint lPos = pEvent->position().toPoint();
    40914094#endif
    40924095
    40934096    /* Acquire indexes: */
    40944097    const QModelIndex currentIndex = m_pTreeViewStorage->currentIndex();
    4095     const QModelIndex index = m_pTreeViewStorage->indexAt(pEvent->pos());
     4098    const QModelIndex index = m_pTreeViewStorage->indexAt(lPos);
    40964099    const QRect indexRect = m_pTreeViewStorage->visualRect(index);
    40974100
     
    41054108        QRect expanderRect = m_pModelStorage->data(index, StorageModel::R_ItemPixmapRect).toRect();
    41064109        expanderRect.translate(indexRect.x(), indexRect.y());
    4107         if (expanderRect.contains(pEvent->pos()))
     4110        if (expanderRect.contains(lPos))
    41084111        {
    41094112            pEvent->setAccepted(true);
     
    41454148            deviceRect.translate(indexRect.x() + indexRect.width(), indexRect.y());
    41464149
    4147             if (deviceRect.contains(pEvent->pos()))
     4150            if (deviceRect.contains(lPos))
    41484151            {
    41494152                pEvent->setAccepted(true);
     
    41894192
    41904193    /* Check what item we are hovering currently: */
     4194#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    41914195    QModelIndex index = m_pTreeViewStorage->indexAt(pEvent->pos());
     4196#else
     4197    QModelIndex index = m_pTreeViewStorage->indexAt(pEvent->position().toPoint());
     4198#endif
    41924199    AbstractItem *pItem = static_cast<AbstractItem*>(index.internalPointer());
    41934200    /* And make sure this is controller item, we are supporting dropping for this kind only: */
     
    42174224
    42184225    /* Check what item we are hovering currently: */
     4226#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    42194227    QModelIndex index = m_pTreeViewStorage->indexAt(pEvent->pos());
     4228#else
     4229    QModelIndex index = m_pTreeViewStorage->indexAt(pEvent->position().toPoint());
     4230#endif
    42204231    AbstractItem *pItem = static_cast<AbstractItem*>(index.internalPointer());
    42214232    /* And make sure this is controller item, we are supporting dropping for this kind only: */
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp

    r99948 r100344  
    28382838UISoftKeyboardKey *UISoftKeyboardWidget::keyUnderMouse(QMouseEvent *pEvent)
    28392839{
    2840     QPoint eventPosition(pEvent->pos().x() / m_fScaleFactorX, pEvent->pos().y() / m_fScaleFactorY);
     2840#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
     2841    const QPoint lPos = pEvent->pos();
     2842#else
     2843    const QPoint lPos = pEvent->position().toPoint();
     2844#endif
     2845    QPoint eventPosition(lPos.x() / m_fScaleFactorX, lPos.y() / m_fScaleFactorY);
    28412846    if (m_fHideMultimediaKeys)
    28422847        eventPosition.setY(eventPosition.y() + m_multiMediaKeysLayout.totalHeight());
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISpecialControls.cpp

    r98103 r100344  
    174174void UIHelpButton::mousePressEvent(QMouseEvent *pEvent)
    175175{
     176#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
    176177    if (hitButton(pEvent->pos()))
     178#else
     179    if (hitButton(pEvent->position().toPoint()))
     180#endif
    177181        m_pButtonPressed = true;
    178182    QPushButton::mousePressEvent(pEvent);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIStatusBarEditorWindow.cpp

    r100086 r100344  
    653653
    654654    /* Get event position: */
    655     const QPoint pos = pEvent->pos();
     655#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
     656    const QPoint lPos = pEvent->pos();
     657#else
     658    const QPoint lPos = pEvent->position().toPoint();
     659#endif
    656660    /* Search for most suitable button: */
    657661    foreach (const IndicatorType &enmType, m_order)
     
    659663        m_pButtonDropToken = m_buttons.value(enmType);
    660664        const QRect geo = m_pButtonDropToken->geometry();
    661         if (pos.x() < geo.center().x())
     665        if (lPos.x() < geo.center().x())
    662666        {
    663667            m_fDropAfterTokenButton = false;
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.cpp

    r100086 r100344  
    917917    /* Make sure event is valid: */
    918918    AssertPtrReturnVoid(pEvent);
     919#ifndef VBOX_IS_QT6_OR_LATER /* QMouseEvent::pos was replaced with QSinglePointEvent::position in Qt6 */
     920    const QPoint lPos = pEvent->pos();
     921#else
     922    const QPoint lPos = pEvent->position().toPoint();
     923#endif
     924
    919925    /* And mime-data is set: */
    920926    const QMimeData *pMimeData = pEvent->mimeData();
     
    929935    m_fDropAfterTokenItem = true;
    930936
    931     /* Get event position: */
    932     const QPoint pos = pEvent->pos();
    933937    /* Search for most suitable item: */
    934938    foreach (UITabBarItem *pItem, m_aItems)
     
    937941        m_pItemToken = pItem;
    938942        const QRect geo = m_pItemToken->geometry();
    939         if (pos.x() < geo.center().x())
     943        if (lPos.x() < geo.center().x())
    940944        {
    941945            m_fDropAfterTokenItem = false;
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