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

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3: Somewhat important 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)

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes