VirtualBox

Ignore:
Timestamp:
Apr 30, 2021 2:47:36 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144143
Message:

FE/Qt: bugref:9289: Details pane: Make sure context menu always fully visible on screen.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsModel.cpp

    r88552 r88809  
    2525
    2626/* GUI includes: */
     27#include "UICommon.h"
    2728#include "UIConverter.h"
     29#include "UIDesktopWidgetWatchdog.h"
    2830#include "UIDetails.h"
    2931#include "UIDetailsContextMenu.h"
     32#include "UIDetailsElement.h"
     33#include "UIDetailsGroup.h"
    3034#include "UIDetailsModel.h"
    31 #include "UIDetailsGroup.h"
    32 #include "UIDetailsElement.h"
    3335#include "UIDetailsView.h"
    3436#include "UIExtraDataManager.h"
    35 #include "UICommon.h"
    3637
    3738
     
    982983
    983984    /* Adjust the menu then show it: */
    984     m_pContextMenu->resize(m_pContextMenu->minimumSizeHint());
    985     m_pContextMenu->move(pEvent->screenPos());
     985    const QRect availableGeo = gpDesktop->availableGeometry(pEvent->screenPos());
     986    QRect geo(pEvent->screenPos(), m_pContextMenu->minimumSizeHint());
     987    if (geo.topRight().x() > availableGeo.topRight().x())
     988        geo.adjust(availableGeo.topRight().x() - geo.topRight().x(), 0,
     989                   availableGeo.topRight().x() - geo.topRight().x(), 0);
     990    if (geo.bottomLeft().y() > availableGeo.bottomLeft().y())
     991        geo.adjust(0, availableGeo.bottomLeft().y() - geo.bottomLeft().y(),
     992                   0, availableGeo.bottomLeft().y() - geo.bottomLeft().y());
     993    m_pContextMenu->resize(geo.size());
     994    m_pContextMenu->move(geo.topLeft());
    986995    m_pContextMenu->show();
    987996
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