控制面板VPN【···】弹出菜单偏移问题

This commit is contained in:
zhangyuanyuan1 2023-07-18 11:10:40 +08:00
parent 3a993cd5c7
commit 98825a8fd3
1 changed files with 2 additions and 2 deletions

View File

@ -176,11 +176,11 @@ bool VpnItem::eventFilter(QObject *watched, QEvent *event)
{
//菜单右边界与按钮右边界对齐
if (event->type() == QEvent::Show && watched == m_moreMenu) {
int menuXPos = m_moreMenu->pos().x();
int menuWidth = m_moreMenu->size().width();
int btnWidth = m_moreButton->size().width();
int btnGlobalXPos = mapToGlobal(m_moreButton->pos()).x();
QPoint pos = QPoint (menuXPos - menuWidth + btnWidth, m_moreMenu->pos().y());
QPoint pos = QPoint (btnGlobalXPos - menuWidth + btnWidth, m_moreMenu->pos().y());
m_moreMenu->move(pos);
return true;
}