mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-25 01:18:22 +08:00
Fix menu issues in macOS
This commit is contained in:
parent
77d771d452
commit
3d73801e21
@ -1103,16 +1103,19 @@ void UEFITool::scrollTreeView(QTableWidgetItem* item)
|
|||||||
|
|
||||||
void UEFITool::contextMenuEvent(QContextMenuEvent* event)
|
void UEFITool::contextMenuEvent(QContextMenuEvent* event)
|
||||||
{
|
{
|
||||||
if (ui->parserMessagesListWidget->underMouse() ||
|
// The checks involving underMouse do not work well enough on macOS, and result in right-click sometimes
|
||||||
ui->finderMessagesListWidget->underMouse() ||
|
// not showing any context menu at all. Most likely it is a bug in Qt, which does not affect other systems.
|
||||||
ui->builderMessagesListWidget->underMouse()) {
|
// For this reason we reimplement this manually.
|
||||||
|
if (ui->parserMessagesListWidget->rect().contains(ui->parserMessagesListWidget->mapFromGlobal(event->globalPos())) ||
|
||||||
|
ui->finderMessagesListWidget->rect().contains(ui->finderMessagesListWidget->mapFromGlobal(event->globalPos())) ||
|
||||||
|
ui->builderMessagesListWidget->rect().contains(ui->builderMessagesListWidget->mapFromGlobal(event->globalPos()))) {
|
||||||
ui->menuMessageActions->exec(event->globalPos());
|
ui->menuMessageActions->exec(event->globalPos());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ui->structureTreeView->underMouse()) {
|
|
||||||
|
if (!ui->structureTreeView->rect().contains(ui->structureTreeView->mapFromGlobal(event->globalPos())))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
QPoint pt = event->pos();
|
QPoint pt = event->pos();
|
||||||
UModelIndex index = ui->structureTreeView->indexAt(ui->structureTreeView->viewport()->mapFrom(this, pt));
|
UModelIndex index = ui->structureTreeView->indexAt(ui->structureTreeView->viewport()->mapFrom(this, pt));
|
||||||
@ -1137,6 +1140,9 @@ void UEFITool::contextMenuEvent(QContextMenuEvent* event)
|
|||||||
case Types::FtwStore:
|
case Types::FtwStore:
|
||||||
case Types::FlashMapStore:
|
case Types::FlashMapStore:
|
||||||
case Types::CmdbStore: ui->menuStoreActions->exec(event->globalPos()); break;
|
case Types::CmdbStore: ui->menuStoreActions->exec(event->globalPos()); break;
|
||||||
|
//FIXME: Currently no actions are available for volume free space, and the menu is autoclosed immediately on macOS.
|
||||||
|
// Temporarily prevent it from showing in the first place. Should later explore why it disappears immediately.
|
||||||
|
case Types::FreeSpace: break;
|
||||||
default: ui->menuEntryActions->exec(event->globalPos()); break;
|
default: ui->menuEntryActions->exec(event->globalPos()); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user