Breeze style problem since Qt 6.8.2
David Redondo
kde at david-redondo.de
Mon Mar 24 08:22:02 GMT 2025
Am Dienstag, 18. März 2025, 21:59 schrieb Tobias Leupold:
> E-Mail von Tobias Leupold vom Montag, 17. März 2025, 22:50:
> > E-Mail von Albert Astals Cid vom Montag, 17. März 2025, 20:38:
> > > Can you bisect in which commit the behaviour was introduced?
> >
> > According to what was said on the Qt forums, it should be those two:
> >
> > https://codereview.qt-project.org/c/qt/qtbase/+/601315
> > https://codereview.qt-project.org/c/qt/qtbase/+/613831
> >
> > cf. https://forum.qt.io/topic/160958/
>
> ... and as another follow-up:
>
> I messed around with this stuff a bit now.
>
> Using Qt 6.8.1, when no style sheet is set, sizeFromContents() is requested
> from Breeze when a QSpinBox should be drawn. It returns QSize(52, 32), and the
> QSpinBox's height is rendered as 32 px, most probably by the default Qt style
> class, I didn't find out yet where this happens.
>
> If a style sheet is set, QStyleSheetStyle::sizeFromContents() comes into play.
> But Breeze's sizeFromContents() is not called in this case. The size stays
> initialized to
>
> QRenderRule rule = renderRule(w, opt);
> QSize sz = rule.adjustSize(csz);
>
> which is QSize(36, 20).
>
> Later on, (rule.hasBox() || rule.hasBorder() || !rule.hasNativeBorder())
> matches, and the size is increased to QSize(48, 32) by sz = rule.boxSize(sz).
> The resulting QSpinBox is thus also drawn with a height of 32 px (looks like
> coincidence to me, as Breeze isn't involved at all?!).
>
>
> This changed in Qt 6.8.2:
>
> When no style sheet is set, the behavior is the same. Breeze's
> sizeFromContents() is called, returns QSize(52, 32), and the QSpinBox's height
> is rendered as 32 px.
>
> But as soon as a style sheet is set, QStyleSheetStyle::sizeFromContents()
> takes over. But it behaves differently now: The initial size is overwritten
> with what Breeze's sizeFromContents() returns. Which is at this point still a
> size with the correct height of 32 px.
>
> And then, as with 6.8.1, (rule.hasBox() || rule.hasBorder() || !
> rule.hasNativeBorder()) matches and the size increased via sz =
> rule.boxSize(sz). But now not from the initial QSize(36, 20) (which doesn't
> come from Breeze), but from Breeze's QSize(52, 32), thus resulting in
> QSize(64, 44). And here we get a QSpinBox that is rendered too tall.
>
>
> I don't have enough insight of all this to decide if Qt doesn't behave
> correctly here, or if Breeze should do something different. I'm not sure
> though if Breeze can know at all if QStyleSheetStyle::sizeFromContents() calls
> its sizeFromContents() (where we would need a modified QSpinBox height to get
> what we actually want) or if the default style class calls it, where the the
> size Breeze returns is rendered as-is.
>
>
> However, I hope this helps either the Qt or the Breeze guys to figure out who
> is responsible here and who is free of guilt ...
>
>
>
This matches my investigation previously. Not sure why the Qt person was so
dismissive that it was a Breeze bug from my limited knowledge Breeze looks to
be doing correct things. Maybe I didnt word it clear enough?
David
More information about the kde-devel
mailing list