VirtualBox

Changeset 75645 in vbox


Ignore:
Timestamp:
Nov 21, 2018 3:32:58 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126823
Message:

FE/Qt: bugref:8694: Make sure status-bar indicator context menu is opened at proper position in multi-screen environment with different system scale-factors; For that we have to use dynamical coordinate mapping instead of coordinates provided via QContextMenuEvent.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
4 edited

Legend:

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

    r75361 r75645  
    12731273}
    12741274
     1275QPoint UIIndicatorsPool::mapIndicatorPositionToGlobal(IndicatorType enmIndicatorType, const QPoint &indicatorPosition)
     1276{
     1277    if (m_pool.contains(enmIndicatorType))
     1278        return m_pool.value(enmIndicatorType)->mapToGlobal(indicatorPosition);
     1279    return QPoint(0, 0);
     1280}
     1281
    12751282void UIIndicatorsPool::sltHandleConfigurationChange(const QUuid &uMachineID)
    12761283{
     
    13361343        {
    13371344            /* Notify listener: */
    1338             emit sigContextMenuRequest(indicatorType, pEvent->globalPos());
     1345            emit sigContextMenuRequest(indicatorType, pEvent->pos());
    13391346            return;
    13401347        }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.h

    r74942 r75645  
    6464    void setAutoUpdateIndicatorStates(bool fEnabled);
    6565
     66    /** Returns global screen position corresponding to @a indicatorPosition inside indicator of @a enmIndicatorType. */
     67    QPoint mapIndicatorPositionToGlobal(IndicatorType enmIndicatorType, const QPoint &indicatorPosition);
     68
    6669private slots:
    6770
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r75319 r75645  
    205205}
    206206
    207 void UIMachineWindowNormal::sltHandleIndicatorContextMenuRequest(IndicatorType indicatorType, const QPoint &position)
     207void UIMachineWindowNormal::sltHandleIndicatorContextMenuRequest(IndicatorType enmIndicatorType, const QPoint &indicatorPosition)
    208208{
    209209    /* Determine action depending on indicator-type: */
    210210    UIAction *pAction = 0;
    211     switch (indicatorType)
     211    switch (enmIndicatorType)
    212212    {
    213213        case IndicatorType_HardDisks:     pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_HardDrives);     break;
     
    226226    /* Raise action's context-menu: */
    227227    if (pAction && pAction->isEnabled())
    228         pAction->menu()->exec(position);
     228        pAction->menu()->exec(m_pIndicatorsPool->mapIndicatorPositionToGlobal(enmIndicatorType, indicatorPosition));
    229229}
    230230
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h

    r75291 r75645  
    7878    void sltHandleStatusBarContextMenuRequest(const QPoint &position);
    7979    /** Handles status-bar indicator context-menu-request. */
    80     void sltHandleIndicatorContextMenuRequest(IndicatorType indicatorType, const QPoint &position);
     80    void sltHandleIndicatorContextMenuRequest(IndicatorType enmIndicatorType, const QPoint &indicatorPosition);
    8181
    8282#ifdef VBOX_WS_MAC
Note: See TracChangeset for help on using the changeset viewer.

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