Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-133845

QSpinBoxes take too much vertical space if an application-wide style sheet is set since Qt 6.8.2

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.2
    • Widgets: Style Sheets
    • None

    Description

      Hi Devs!

      Using Qt 6.8.2, if an application-wide style sheet is set, QSpinBoxes take too much vertical space. This is a regression surfaced with Qt 6.8.2, it was not present yet in Qt 6.8.1.

      I first thought this was a Plasma Breeze issue, because I didn't see it when using Fusion. I asked in the forums where to begin to search. Decently, Christian Ehrlicher replied at once and mentioned the following two changes that may have caused this: 

      https://codereview.qt-project.org/c/qt/qtbase/+/601315
      https://codereview.qt-project.org/c/qt/qtbase/+/613831

      So I filed a KDE bug report at https://bugs.kde.org/show_bug.cgi?id=499906

      Somebody with more insight of that replied and stated this was actually an upstream bug, I'll cite:

      I added some debug output and to me it looks like a bug in Qt StyleSheetStyle. Without a stylesheet content Breeze sizeFromContents returns QSize(52, 32). WIth a stylesheet it returns the same value. However stylesheet style goes into this clause

      https://invent.kde.org/qt/qt/qtbase/-/blob/6.8.2/src/widgets/styles/qstylesheetstyle.cpp?ref_type=heads#L5317

      and returns QSize(64, 44) looking more closely rule.hasBorder() is true (rule.box() is null and rule.hasNativeBorder() is true). With fusion the base style returns QSize(42, 23) and stylesheet style expands that to QSize(48, 29). Not sure why there is no visible difference but I have no knowledge about the QStyleSheet implementation. I am sorry but I think we need to send this back to Qt.

      … so here we are! Would be nice if this was fixed! I'll attach a (quite trivial) minimal example producing the problem along with some screen shots.

      Attachments

        1. main.cpp
          0.3 kB
        2. MainWindow.cpp
          0.3 kB
        3. MainWindow.h
          0.2 kB
        4. CMakeLists.txt
          0.2 kB
        5. fusion.png
          fusion.png
          3 kB
        6. breeze_no_css.png
          breeze_no_css.png
          4 kB
        7. breeze_with_css.png
          breeze_with_css.png
          4 kB
        8. qspinbox.patch
          0.9 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              l3u Tobias Leupold
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes