diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-03 10:09:26 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-04 12:52:59 +0200 |
| commit | 229eecbf1893ad002d700f83ee7d8a2babbd595e (patch) | |
| tree | 183d6a734c0265d9c10af4f9b42d69dd9a1d2015 /src/mainwindow.cpp | |
| parent | 6caea6aabe74014f9bdd2b8743925362bad19fe9 (diff) | |
| download | qtmaildir-229eecbf1893ad002d700f83ee7d8a2babbd595e.tar.gz qtmaildir-229eecbf1893ad002d700f83ee7d8a2babbd595e.zip | |
fix: let key bindings win over the thread list's type-to-search
With the thread list focused, 'h' jumped to the next thread whose subject
began with "h" instead of toggling HTML, and j, k, a, d, N, F, u and G were
swallowed the same way. The keymap only worked when focus happened to be
somewhere else.
installEventFilter(this) was on the MainWindow, and a window-level filter
only sees key presses the focused child did not consume. QAbstractItemView
consumes plain letters for its type-to-search feature, so it took them
first. The filter is now installed on the thread view as well, which puts
the keymap ahead of that search. The existing query-bar guard in
eventFilter() still keeps ordinary typing working there.
Found by the maintainer while walking task 13 item 14, and confirmed fixed
on screen.
No regression test: a QTest::keyClick attempt passed both with and without
the fix, because synthetic key posting does not reproduce the focus and
consumption path that causes the bug. A test that cannot fail is worse than
none, so it was dropped rather than kept for appearances.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d6eccf9..c24a48f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -72,6 +72,15 @@ MainWindow::MainWindow(const Config &config, QWidget *parent) installEventFilter(this); + // The thread view needs its own filter, not just the window's. A filter on + // the window only sees key presses the focused child did not consume, and + // QAbstractItemView consumes plain letters for its type-to-search feature: + // with the list focused, 'h' jumped to the next thread whose subject began + // with "h" instead of toggling HTML, and every other single-letter binding + // (j, k, a, d, N, F, u, G) was swallowed the same way. Filtering the view + // itself puts the keymap ahead of that search. + m_threadView->installEventFilter(this); + if (!m_config.savedQueries().isEmpty()) { m_queryEdit->setText(m_config.savedQueries().first().query); runCurrentQuery(); |
