Bug 482657 - Underlined characters in titles rendered incorrectly as ampersands in KDE6
Summary: Underlined characters in titles rendered incorrectly as ampersands in KDE6
Status: REPORTED
Alias: None
Product: frameworks-ki18n
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 6.0.0
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Chusslove Illich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-07 07:46 UTC by Tom Crider
Modified: 2024-03-07 08:55 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
ampersands where titles are. (331.02 KB, image/png)
2024-03-07 07:46 UTC, Tom Crider
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Crider 2024-03-07 07:46:42 UTC
Created attachment 166549 [details]
ampersands where titles are.

In the screenshot attached, there are random ampersands (&) where underlined characters should be in Scenes/Sources etc.

I was hitting it in Nobara first, so I spun up a vanilla fedora 40 VM and was able to reproduce
it only happens with obs-studio + KDE 6
furthermore I can do XDG_CURRENT_DESKTOP=gnome and it works around the bug.

After digging I found if I remove kf6-ki18n it fixes it. (forcefully via rpm -e --nodeps). Obv, not an actual fix but at least a lead on the cause.

Original obs-studio bug report opened here:
https://github.com/obsproject/obs-studio/issues/10341
Comment 1 Tom Crider 2024-03-07 08:53:48 UTC
Turns out this is a QT bug.
Same bug listed here:

https://bugreports.qt.io/browse/QTBUG-86407

The same fix from this commit:
https://github.com/qt/qtbase/commit/cc67b25579c1bb5ea9f5c1ca4c9b7997e66f19b9

Also needs to be applied to QDockWidget inside qstylesheetstyle. obs-studio uses stylesheets so that clued me in:
```
From 519cfee1bb6c1477a2cc5efdb2c9997904ddcbed Mon Sep 17 00:00:00 2001
From: GloriousEggroll <gloriouseggroll@gmail.com>
Date: Thu, 7 Mar 2024 01:28:08 -0700
Subject: [PATCH] fix underlined text in dock widget titles rendering as
 ampersands

---
 src/widgets/styles/qstylesheetstyle.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 1ba8aa7c..37685b5f 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -4484,7 +4484,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
 
                 QString titleText = p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, r.width());
                 drawItemText(p, r,
-                             alignment, dwOpt->palette,
+                             alignment | Qt::TextHideMnemonic, dwOpt->palette,
                              dwOpt->state & State_Enabled, titleText,
                              QPalette::WindowText);
 
-- 
2.44.0

```
Comment 2 Tom Crider 2024-03-07 08:55:58 UTC
For additional reference I also noticed when loaded correctly in gnome it does not have underlined characters on the dock widget titles, so this should be the correct behavior for kde as well.