Bug 489516

Summary: The space reserved for the text of a QDockWidget tab is not enough in some situations
Product: [Plasma] kwin Reporter: Tobias Leupold <tl>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: nate, tl
Priority: NOR    
Version First Reported In: 6.1.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: The cutoff text using Breeze
The cutoff text using Fusion
demo.pro
main.cpp
MainWindow.cpp
MainWindow.h

Description Tobias Leupold 2024-06-30 20:01:00 UTC
Hi all,

this is one weird bug. I'm not completely sure if KWin is to blame, or if the problem resides elsewhere. I'm also not sure how to track this down. But I have a minimal example producing the problem reliably, so I hope you know ;-)

The problem is that, using a Plasma 6 desktop and Noto Sans 10pt as the font, it happens that when tabifying QDockWidgets of a Qt 6 program, the resulting tab texts are sometimes cut off, although there would be enough space. Please see the screenshots I'll attach to see what I mean. This happens both with Breeze and Fusion, so I think it's no style issue.

I can produce this exact behavior on my Gentoo desktop and also on my Artix notebook. Both running plasma 6.1.1, Gentoo with Qt 6.7.1, Artix with 6.7.2.

This does not happen when using a Plasma 5 desktop, neither for a Qt 5 build, nor for a Qt 6 build. Everything is fine using Plasma 5. I tried this using a current KUbuntu in a QEMU VM. Both the Qt 5 and 6 builds of my demo don't cut off the text.

But I could also reproduce this using am OpenSUSE Tumbleweed QEMU VM, running a Plasma 6 desktop. Here, the Qt 5 build looks fine, but the Qt 6 build cuts off the text, just as with my Gentoo and Artix machines.

Interestingly, the cutoff does not happen when:
- Another Font is used
- Noto Sans is used, but another size (9 or 11)
- The docks are not hidden first
- The docks are hidden after a small delay, e.g. by a QTimer::singleShot waiting 100 ms (0 ms has the same result as hiding them directly)
- The name of the cut off dock is slightly changed, e.g. from "Ergebnisse" to "ErgebnisseX", "Ergebnisse " or similar
- The name of the "Extras" menu entry is changed, e.g. from "Extras" to "X" (how can that ever affect this at all?!)

Well, as said, this is an odd one ...

I'll attach the screenshots, one using Breeze and one using Fusion, as well as the minimal example producing the bug (as said, only when built against Qt 6, using Noto Sans 10pt and when run on a Plasma 6 desktop).

I'd really love to help tracking this down if I can!
Comment 1 Tobias Leupold 2024-06-30 20:01:35 UTC
Created attachment 171210 [details]
The cutoff text using Breeze
Comment 2 Tobias Leupold 2024-06-30 20:01:53 UTC
Created attachment 171211 [details]
The cutoff text using Fusion
Comment 3 Tobias Leupold 2024-06-30 20:02:23 UTC
Created attachment 171212 [details]
demo.pro
Comment 4 Tobias Leupold 2024-06-30 20:02:37 UTC
Created attachment 171213 [details]
main.cpp
Comment 5 Tobias Leupold 2024-06-30 20:02:50 UTC
Created attachment 171214 [details]
MainWindow.cpp
Comment 6 Tobias Leupold 2024-06-30 20:03:01 UTC
Created attachment 171215 [details]
MainWindow.h
Comment 7 Nate Graham 2024-07-02 19:55:24 UTC
Since this affects QDockWidget (which is not KDE code) and also multiple QStyles (including non-KDE ones), I think it's safe to say this is a Qt 6 regression. Please report it at https://bugreports.qt.io/. That should be happy to see your test program!
Comment 8 Tobias Leupold 2024-07-02 20:47:07 UTC
I first was also pretty sure this was a Qt bug … I posted this at the Qt forums ( https://forum.qt.io/topic/157507/how-can-i-ensure-that-the-text-in-the-qtabbar-of-qdockwidgets-is-not-cut-off ), but they told me they could not reproduce it. I then played around with different window managers, and found the fact that it does not happen with Plasma 5, but with Plasma 6. So I thought this should be a KDE issue.

Just to ask this before filing a Qt bug: Can you also see this?!