Project

General

Profile

Sliders within a WGridLayout

Added by Michael Backus over 10 years ago

I've put some sliders into a WGridLayout using the following code:

    WContainerWidget* root = WApplication::instance()->root();
    root->setWidth(360);
    WGridLayout* grid = new WGridLayout();
    root->setLayout(grid);

    filteredFrame_ = new WImage("filteredFrame.jpg");
    frame_ = new WImage("frame.jpg");

    sliderHueMin = new WSlider();
    sliderHueMin->setOrientation(Vertical);
    sliderHueMin->setMinimum(0);
    sliderHueMin->setMaximum(255);
    sliderHueMin->setValue(hueMin);
    sliderHueMin->sliderMoved().connect(this, &ControlPanel::sliderHueMinMoved);

    sliderHueMax = new WSlider();
    sliderHueMax->setOrientation(Vertical);
    sliderHueMax->setMinimum(0);
    sliderHueMax->setMaximum(255);
    sliderHueMax->setValue(hueMax);
    sliderHueMax->sliderMoved().connect(this, &ControlPanel::sliderHueMaxMoved);

    grid->addWidget(filteredFrame_,0,0);
    grid->addWidget(frame_,1,0);
    grid->addWidget(sliderHueMin,0,1);
    grid->addWidget(sliderHueMax,0,2);

The result creates sliders in the desired location, but it pulls the handles off the sliders and they take up more width than I would expect (see attached).

Is there a way to make the grid layout collapse the width of the columns occupied by the sliders? Why are the handles being pulled off the sliders? Is this a bug in my version of Wt, or am I doing something wrong? I'm using 3.2.1-2+deb7u1.