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

QSpinBox widget height changes when a stylesheet is set even if it's invalid

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.8.1, 6.9.0 FF
    • 5.12.10, 5.14.2, 5.15.2
    • Widgets: Styles
    • None
    • All
    • 96adebed6 (dev), 168f4aee2 (6.8)

    Description

      I discovered this issue when upgrading a Qt project from 5.2.1 to 5.14. 

      When setting a stylesheet, in my case the  background-color  property, the height of the widget is decreased when 1px. Removing the stylesheet again resizes the widget to it's original size. 

      Even if the stylesheet is invalid e.g. widget->setStyleSheet("blulb") causes this issue.

      I tried to bypass this issue by supplying the actual height. However that didn't worked it seems that the supplied height is used for the underlying qlineedit widget. So setting an height of 24px triggers a total widget height of 30px which is imo also a bit weird.

      I finally temporary resolved this by extending the QDoubleSpinBox widget and add an alternative setstylesheet method that appends the qlineedit height to the stylesheet.

      Btw, this issue didn't exist in 5.2.1 it might be because the stylesheet was only applied on the underlying qlinedit, just saying.

      Attachments

        Issue Links

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

          Activity

            People

              chehrlic Christian Ehrlicher
              lcoudeville Laurens Coudeville
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes