Skip to content

Commit 4993d96

Browse files
committed
Enable access key underline of menu bar items when focused
* Fixes #7325
1 parent 8d6d937 commit 4993d96

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

share/translations/keepassxc_en.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -5561,10 +5561,6 @@ Are you sure you want to continue with this file?</source>
55615561
<source>&amp;Tools</source>
55625562
<translation type="unfinished"></translation>
55635563
</message>
5564-
<message>
5565-
<source>View</source>
5566-
<translation type="unfinished"></translation>
5567-
</message>
55685564
<message>
55695565
<source>Theme</source>
55705566
<translation type="unfinished"></translation>
@@ -6230,6 +6226,10 @@ Expect some bugs and minor issues, this version is meant for testing purposes.</
62306226
<source>E&amp;xpire Entry…</source>
62316227
<translation type="unfinished"></translation>
62326228
</message>
6229+
<message>
6230+
<source>&amp;View</source>
6231+
<translation type="unfinished"></translation>
6232+
</message>
62336233
</context>
62346234
<context>
62356235
<name>ManageDatabase</name>

src/gui/MainWindow.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@
373373
</widget>
374374
<widget class="QMenu" name="menuView">
375375
<property name="title">
376-
<string>View</string>
376+
<string>&amp;View</string>
377377
</property>
378378
<widget class="QMenu" name="menuTheme">
379379
<property name="title">

src/gui/styles/base/BaseStyle.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <QFile>
3030
#include <QHeaderView>
3131
#include <QListView>
32+
#include <QMenuBar>
3233
#include <QPainter>
3334
#include <QPainterPath>
3435
#include <QPoint>
@@ -4680,7 +4681,15 @@ int BaseStyle::styleHint(StyleHint hint,
46804681
case SH_WindowFrame_Mask:
46814682
return 0;
46824683
case SH_UnderlineShortcut: {
4683-
return false;
4684+
#if defined(Q_OS_WIN) or defined (Q_OS_LINUX)
4685+
// Only show underline shortcuts if the user focused with ALT (Win/Linux only)
4686+
auto mb = qobject_cast<const QMenuBar*>(widget);
4687+
if (mb && !mb->hasFocus()) {
4688+
return 0;
4689+
}
4690+
#endif
4691+
// Let Qt handle this for platform specific behavior
4692+
break;
46844693
}
46854694
case SH_Widget_Animate:
46864695
return 1;

0 commit comments

Comments
 (0)