Bug 488195

Summary: Breeze on Plasma 6 doesn't render the QFrame::StyledPanel frame style
Product: [Plasma] Breeze Reporter: Tobias Leupold <tl>
Component: QStyleAssignee: Plasma Bugs List <plasma-bugs-null>
Status: REPORTED ---    
Severity: normal CC: carl, kde, kdelibs-bugs-null, nate, noahadvs, tl, uhhadd
Priority: NOR Keywords: regression
Version First Reported In: 6.0.5   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: CMakeLists_qt5.txt
CMakeLists_qt6.txt
main.cpp
MainWindow.cpp
MainWindow.h
plasma5_qt5_breeze.png
plasma5_qt5_fusion.png
plasma5_qt6_fusion.png
plasma6_qt5_fusion.png
plasma6_qt6_breeze.png
plasma6_qt6_fusion.png

Description Tobias Leupold 2024-06-08 08:30:59 UTC
Hi all!

I noticed Breeze on Plasma 6 not rendering the StyledPanel frame style for a QLabel.

Using the attached minimal example, everything works as expected on my Gentoo machine running Plasma 5: For a Qt 5 build using the (default) Breeze style, a styled frame is drawn. I also get a frame using the Fusion style. For a Qt 6 build, obviously there's no Breeze style here, so it starts with Fusion by default; however, I also get a frame (cf. the "plasma5" screenshots).

On my Artix machine running Plasma 6, I both get a frame for a Qt 5 and Qt 6 build using the Fusion style, but no frame is drawn when I use Breeze.

Seems like Plasma 6's Breeze is missing something here ...

Cheers, Tobias
Comment 1 Tobias Leupold 2024-06-08 08:31:43 UTC
Created attachment 170251 [details]
CMakeLists_qt5.txt
Comment 2 Tobias Leupold 2024-06-08 08:31:58 UTC
Created attachment 170252 [details]
CMakeLists_qt6.txt
Comment 3 Tobias Leupold 2024-06-08 08:32:12 UTC
Created attachment 170253 [details]
main.cpp
Comment 4 Tobias Leupold 2024-06-08 08:32:25 UTC
Created attachment 170254 [details]
MainWindow.cpp
Comment 5 Tobias Leupold 2024-06-08 08:32:41 UTC
Created attachment 170255 [details]
MainWindow.h
Comment 6 Tobias Leupold 2024-06-08 08:33:04 UTC
Created attachment 170256 [details]
plasma5_qt5_breeze.png
Comment 7 Tobias Leupold 2024-06-08 08:33:29 UTC
Created attachment 170257 [details]
plasma5_qt5_fusion.png
Comment 8 Tobias Leupold 2024-06-08 08:33:44 UTC
Created attachment 170258 [details]
plasma5_qt6_fusion.png
Comment 9 Tobias Leupold 2024-06-08 08:33:58 UTC
Created attachment 170259 [details]
plasma6_qt5_fusion.png
Comment 10 Tobias Leupold 2024-06-08 08:34:13 UTC
Created attachment 170260 [details]
plasma6_qt6_breeze.png
Comment 11 Tobias Leupold 2024-06-08 08:35:00 UTC
Created attachment 170261 [details]
plasma6_qt6_fusion.png
Comment 12 Nate Graham 2024-06-10 19:34:30 UTC
I think this may have been an intentional change; see https://invent.kde.org/frameworks/kwidgetsaddons/-/merge_requests/251. Friedrich, can you comment on whether the exact effects described in this bugzilla ticket were intentional or not?
Comment 13 Friedrich W. H. Kossebau 2024-06-10 19:58:45 UTC
That MR/change in KWidgetsAddons was about KTitleWidget no longer using a QLabel with that style, so unrelated.

This is an implementation issue of the Breeze style (BTW Oxygen similarly does not render a frame for that), so moving over to Breeze.
Comment 14 Tobias Leupold 2024-12-05 12:48:11 UTC
Is there something I can do to help here? I'm still seeing this with Breeze 6.2.4, and I'd really like to get StyledPanel frame styles for QLabels back ;-)
Comment 15 Tobias Leupold 2024-12-06 09:06:12 UTC
After some investigation, I found that not only QLabel is affected, but also QFrame as a base class.

QLabel inherits QFrame, and the paintEvent calls drawFrame(), which calls style()->drawControl(QStyle::CE_ShapedFrame, &opt, p, this).

Looking at qcommonstyle.cpp, for QFrame::Box and QFrame::Panel, direct Qt functions seem to be called (qDrawPlainRect(), qDrawShadeRect() or qDrawShadePanel()), whereas for QFrame::StyledPanel, style()->drawPrimitive(QStyle::PE_Frame, ...) is invoked. QFrame::Box and QFrame::Panel frame shapes are visible, both if set for a plain QFrame as well as for a QLabel.

Looking at breezestyle.cpp, in drawControl(), drawPrimitive() is called and from there drawFramePrimitive(). And here, I'm out of ideas, because drawFramePrimitive() is char by char identical with the KF5/Qt5 version, where the QFrame::StyledPanel shape (combined with the Raised or Sunken state) still was displayed correctly.

I fear somebody with more insight of this would have to look into this :-(
Comment 16 Tobias Leupold 2025-01-27 20:00:10 UTC
https://bugs.kde.org/show_bug.cgi?id=499131 could maybe be another implication of this?!
Comment 17 David Redondo 2025-01-31 09:44:02 UTC
Looks like it was intentional https://invent.kde.org/plasma/breeze/-/commit/c3dde54df6ffdb149d1e4ae223bc409756622d18
Comment 18 Tobias Leupold 2025-01-31 11:35:08 UTC
Huh? But why!? If this was really, for some reason I don't get at the moment, intentional: Could someone explain why I shouldn't be able to draw a frame around a label anymore if I want to? And: Can I work around this somehow?!
Comment 19 Tobias Leupold 2025-01-31 12:16:39 UTC
I just tested it. I couldn't revert c3dde54df6ffdb149d1e4ae223bc409756622d18 automatically via git revert, so I did manually create a patch to revert this very change. This brought back e.g. drawing frames around a QLabel if explicitely requested (via setFrameStyle(QFrame::StyledPanel | QFrame::Sunken)).

Carl, would you be so nice to explain what's the intention of this? And why this was added this way This does break existing functionality … one can't request to draw a frame around anything that doesn't have one by default anymore – and I think we should be able to do this, no?!
Comment 20 Tobias Leupold 2025-01-31 12:28:42 UTC
Btw patching this commit away also fixes the missing frame I wrote about in Bug #499131! Imho this behavior is definitely a bug. Why should a QListWidget being the only widget inside a layout get no frame drawn, but one with a label besides should get one?!
Comment 21 Tobias Leupold 2025-02-11 17:34:40 UTC
I create a PR with the patch fixing this: https://invent.kde.org/plasma/breeze/-/merge_requests/520

Please review! This is really an annoying bug, as it visually breaks everything explicitly requestig a styled panel frame, and also some other widgets …