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

Multiple identical QSliders do not resize properly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.3, 5.13.0
    • Fix Version/s: None
    • Component/s: Widgets: Layout
    • Labels:
      None
    • Environment:
      Qt 5.13.0, macOS 10.14.6.
    • Platform/s:
      macOS

      Description

      When I have multiple, identical QSliders, with the same settings and the same value, the sliders do not resize properly when the main window is resized. The sliders are in a layout (it does not matter if this is a QVBoxLayout or a QGridLayout). When the value of at least one slider is different from the others the resizing works as expected. I'm using Qt 5.13.0 on macOS 10.14.6.

      When the sliders are incorrectly sized, and the value of one of the sliders is changed to be different from the other, and the window is resized again, the sliders resize correctly.

      When an incorrectly sized slider is clicked, it immediately resizes properly. But the other sliders remain their old size.

      Minimal example: 

      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent)
      {
          auto w = new QWidget;
          auto layout = new QGridLayout(w);
          setCentralWidget(w);
      
          auto slider1 = new QSlider;
          slider1->setMinimum(0);
          slider1->setMaximum(20);
          slider1->setOrientation(Qt::Horizontal);
          slider1->setTickInterval(5);
          slider1->setTickPosition(QSlider::TicksBelow);
          layout->addWidget(slider1, 0, 0);
      
          auto slider2 = new QSlider;
          slider2->setMinimum(0);
          slider2->setMaximum(20);
          slider2->setOrientation(Qt::Horizontal);
          slider2->setTickInterval(5);
          slider2->setTickPosition(QSlider::TicksBelow);
          layout->addWidget(slider2, 1, 0);
      }
      

       

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            mathijsco Mathijs V
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes