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

QSlider with ticks is glitchy with QFusionStyle

XMLWordPrintable

    • Linux/X11
    • 574692e5a (dev), eb31663d0 (6.7), 3011891fb (6.6), 37df54978 (tqtc/lts-6.5)

      By default, a slider on Linux/X11 with the default QFusionStyle looks like the following:

      Adding ticks, it will look like this:

      We can already observe two things:

      • the top of the cursor is truncated
      • its form doesn't change for a pointed cursor on the tick like on MacOS for example

      Also, there is a weird issue related to focus, which can be observed with the attached video. In that video, I'm just moving the cursor around (never clicking), and we can see the ticks randomly changing colors for unknown reasons. It looks kind of related to focus, but it's inconsistent and unpredictable.

      Note on the video: it's encoded on yuv444p to preserve colors, so the video might not be playable with some players (mpv or vlc will be fine).

      Here is a 20-line sample to reproduce the issue:

      import sys
      from PySide2 import QtCore, QtWidgets
      
      class _Window(QtWidgets.QWidget):
      
          def __init__(self):
              super().__init__()
              slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
              slider.setTickPosition(QtWidgets.QSlider.TicksBelow)
              slider.setValue(50)
              layout = QtWidgets.QVBoxLayout(self)
              layout.addWidget(slider)
      
      
      if __name__ == '__main__':
          app = QtWidgets.QApplication(sys.argv)
          w = _Window()
          w.show()
          sys.exit(app.exec_())
      

      Side note: reproducing the UI with qt-creator leads to the same glitch, but the smallest height resize available seems to stitch it to a viable height.

      Fourth and last related issue reproducible with this slider is the different behavior while clicking on the seekbar: this seems related to the SH_Slider_AbsoluteSetButtons style, but having it inconsistent between platforms is a bummer. On MacOS typically, the slider will jump right to where it's clicked, while on Linux it somehow jumps in the direction of the cursor.

        1. slider-notick.png
          0.7 kB
          U X
        2. slider-tick.png
          0.8 kB
          U X
        3. slider.mp4
          40 kB
          U X
        4. slider_correct@1.png
          5 kB
          Christian Ehrlicher
        5. slider_correct@2.png
          8 kB
          Christian Ehrlicher
        6. slider_wrong@1.png
          5 kB
          Christian Ehrlicher
        7. slider_wrong@2.png
          8 kB
          Christian Ehrlicher
        8. main.cpp
          2 kB
          Christian Ehrlicher
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            ux U X
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes