Skip to content

Commit

Permalink
Ensure gain sliders expand while labels stay fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
csete committed Mar 24, 2018
1 parent e914318 commit 4eb8e69
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/qtgui/dockinputctl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,24 +363,24 @@ void DockInputCtl::setGainStages(gain_list_t &gain_list)
step = (int)(10.0 * gain_list[i].step);
gain = (int)(10.0 * gain_list[i].value);

label = new QLabel(QString("%1 gain").arg(gain_list[i].name.c_str()), this);
label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum));
label = new QLabel(QString("%1 ").arg(gain_list[i].name.c_str()), this);
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);

value = new QLabel(QString("%1 dB").arg(gain_list[i].value, 0, 'f', 1), this);
value->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum));
value = new QLabel(QString(" %1 dB").arg(gain_list[i].value, 0, 'f', 1), this);
value->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);

slider = new QSlider(Qt::Horizontal, this);
slider->setProperty("idx", i);
slider->setProperty("name", QString(gain_list[i].name.c_str()));
slider->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum));
slider->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
slider->setRange(start, stop);
slider->setSingleStep(step);
slider->setValue(gain);
if (abs(stop - start) > 10 * step)
slider->setPageStep(10 * step);

gainLayout->addWidget(label, i, 0, Qt::AlignLeft);
gainLayout->addWidget(slider, i, 1, Qt::AlignCenter);
gainLayout->addWidget(slider, i, 1); // setting alignment would force minimum size
gainLayout->addWidget(value, i, 2, Qt::AlignLeft);

gain_labels.push_back(label);
Expand Down

0 comments on commit 4eb8e69

Please sign in to comment.