Skip to content

Commit

Permalink
17207: Alt+F4 to close a dialog should not activate the top menu
Browse files Browse the repository at this point in the history
  • Loading branch information
krasko78 committed Feb 5, 2025
1 parent fbf69d9 commit e3e61e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/appshell/view/navigableappmenumodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,25 +306,23 @@ bool NavigableAppMenuModel::processEventForAppMenu(QEvent* event)
break;
}

m_needActivateHighlight = false;

if (isNavigationStarted && isNavigateKey(key)) {
navigate(key);
m_needActivateHighlight = false;

event->accept();
return true;
} else if (isNavigationWithSymbol || isNavigationWithAlt) {
QSet<int> activatePossibleKeys = possibleKeys(keyEvent);
if (hasItem(activatePossibleKeys)) {
navigate(activatePossibleKeys);
m_needActivateHighlight = true;

event->accept();
return true;
}
}

m_needActivateHighlight = false;

break;
}
case QEvent::KeyRelease: {
Expand All @@ -337,10 +335,9 @@ bool NavigableAppMenuModel::processEventForAppMenu(QEvent* event)
restoreMUNavigationSystemState();
} else {
if (m_needActivateHighlight) {
m_needActivateHighlight = false;
saveMUNavigationSystemState();
navigateToFirstMenu();
} else {
m_needActivateHighlight = true;
}
}

Expand Down Expand Up @@ -465,6 +462,7 @@ void NavigableAppMenuModel::navigateToSubItem(const QString& menuId, const QSet<
void NavigableAppMenuModel::resetNavigation()
{
setHighlightedMenuId("");
m_needActivateHighlight = false;
}

void NavigableAppMenuModel::navigateToFirstMenu()
Expand Down
2 changes: 1 addition & 1 deletion src/appshell/view/navigableappmenumodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public slots:
QString m_highlightedMenuId;
QString m_openedMenuId;

bool m_needActivateHighlight = true;
bool m_needActivateHighlight = false;
std::optional<MUNavigationSystemState> m_lastActiveMUNavigationState;
bool m_needActivateLastMUNavigationControl = false;

Expand Down

0 comments on commit e3e61e5

Please sign in to comment.