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

QSlider setting styleSheet doesn't change appearance

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 6.8.3
    • Widgets: Style Sheets
    • None
    • Ubuntu 24.04 x64
      Visual Studio Code 1.100.0
      PyQt6-6.8.1
    • Linux/X11

    Description

      I am using Qt with PyQt, but I think this is a general issue. I try to style a QSlider and make the handle and the groove bigger, to make them better usable on a touch ui:

      ...
      layout = self.layout()
      ...
      
      volslider = QSlider(Qt.Orientation.Horizontal)
      volslider.setStyleSheet("QSlider {height: 40px;} QSlider::groove:horizontal {height: 25px;} QSlider::handle:horizontal {height: 40px; width: 40px; margin: -15px 0px;}")
      layout.addWidget(volslider)

      But this doesn't have any affect. But when I add a border-radius to the groove, even with a value of 0, it works:

       

      ...
      layout = self.layout()
      ...
      
      volslider = QSlider(Qt.Orientation.Horizontal)
      volslider.setStyleSheet("QSlider {height: 40px;} QSlider::groove:horizontal {height: 25px; border-radius: 0px;} QSlider::handle:horizontal {height: 40px; width: 40px; margin: -15px 0px;}")
      layout.addWidget(volslider) 

      This happened after an update from an older version, before I used 6.6 and this wasn't an issue.

      Attachments

        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
            drexel M N
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes