Skip to content

Commit 253bb42

Browse files
committed
Prevent AltGr showing the menubar on Windows
* Fixes #11549
1 parent 0b5ae17 commit 253bb42

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/gui/MainWindow.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,6 +2210,15 @@ bool MainWindowEventFilter::eventFilter(QObject* watched, QEvent* event)
22102210
#endif
22112211
} else if (eventType == QEvent::KeyRelease && watched == mainWindow) {
22122212
auto keyEvent = dynamic_cast<QKeyEvent*>(event);
2213+
#ifdef Q_OS_WIN
2214+
// Windows translates AltGr into CTRL + ALT, this breaks using AltGr when the menubar is hidden
2215+
// Prevent this by activating the ALT cooldown to ignore the next key event which will be an ALT key
2216+
if (keyEvent->key() == Qt::Key_Control && keyEvent->modifiers() == Qt::AltModifier
2217+
&& config()->get(Config::GUI_HideMenubar).toBool()) {
2218+
m_altCoolDown.start();
2219+
return false;
2220+
}
2221+
#endif
22132222
if (keyEvent->key() == Qt::Key_Alt && !keyEvent->modifiers() && config()->get(Config::GUI_HideMenubar).toBool()
22142223
&& !m_altCoolDown.isActive()) {
22152224
auto menubar = mainWindow->m_ui->menubar;

0 commit comments

Comments
 (0)