fix(logging): keep Qt's platform chatter out of the journal

Opening a dialog under Wayland made Qt write a burst of qt.qpa
warnings into the application journal — the text-input focus one,
repeated at every prompt — where the user can do nothing with them:
they describe the display server, not the application. Those
categories stay on stderr from now on, next to everything else, while
what the application logs (its own categories, and a bare qCWarning)
keeps going to the journal.
This commit is contained in:
BlackAngelTV committed 2026-10-09 19:22:19 +02:00
1 parent bea3d61045
commit f4aa661b54
4 files changed
+85 -15

No files matched your search

+12 -1
View File
@@ -33,7 +33,9 @@
//
// Every Qt log message (qCDebug/qCInfo/qCWarning/qCCritical) is funnelled into
// the same journal by installQtMessageHandler(), so the categories already used
// across the code base feed it without extra plumbing.
// across the code base feed it without extra plumbing. Qt's own platform
// categories (`qt.qpa.*`) are the one exception: they describe the display
// server, not the application, and stay on stderr (see journalsQtCategory).
//
// The file lives in the user's own data tree (XDG_CONFIG_HOME / home) so it is
// never lost when a sandbox is rebuilt, and both that directory and a size cap
@@ -87,6 +89,15 @@ public:
// QApplication exists. Safe to call more than once.
static void installQtMessageHandler();
// Whether a Qt log category belongs in the journal at all. Qt's platform
// plugins (`qt.qpa.*`: xcb, wayland, ...) narrate the display server, not
// the application: the Wayland one, for instance, repeats a warning about
// its text-input focus for every dialog the user opens, which is a line the
// user can neither read nor act on. Those keep going to stderr, where a
// developer looks for them; everything the application itself logs — its
// own categories, and a bare qCWarning — still lands in the journal.
static bool journalsQtCategory(const QString& category);
signals:
// The journal changed on disk and a fresh copy of its content is available.
void fileUpdated();