Skip to content

Commit

Permalink
InteractiveModelView_adding_support_for_NoModifier_shortcuts_without_…
Browse files Browse the repository at this point in the history
…fixing_focus_issues
  • Loading branch information
szeli1 committed Nov 22, 2024
1 parent 4e5fddf commit 979602d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gui/InteractiveModelView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ bool InteractiveModelView::HandleKeyPress(QKeyEvent* event)
{
if (doesShortcutMatch(&shortcuts[i], event))
{
// selecting the shortcut with the largest `ModelShortcut::times`
// selecting the shortcut with the lowest `ModelShortcut::times`
if (found == false || minMaxTimes > shortcuts[i].times)
{
foundIndex = i;
Expand Down Expand Up @@ -295,7 +295,9 @@ void InteractiveModelView::setIsHighlighted(bool isHighlighted)

bool InteractiveModelView::doesShortcutMatch(const ModelShortcut* shortcut, QKeyEvent* event) const
{
return shortcut->key == event->key() && (event->modifiers() & shortcut->modifier);
// if shortcut key == event key and the shortcut modifier can be found inside event modifiers or there is no modifier
return shortcut->key == event->key() && ((event->modifiers() & shortcut->modifier)
|| (event->nativeModifiers() <= 0 && shortcut->modifier == Qt::NoModifier));
}

bool InteractiveModelView::doesShortcutMatch(const ModelShortcut* shortcutA, const ModelShortcut* shortcutB) const
Expand Down

0 comments on commit 979602d

Please sign in to comment.