Skip to content
Snippets Groups Projects
Commit 01f38113 authored by Matthias Puchner's avatar Matthias Puchner Committed by Wuttke, Joachim
Browse files

docu; add convenience parameter

parent de8b07f1
No related branches found
No related tags found
1 merge request!708Refactor and simplify UI
......@@ -42,10 +42,15 @@ QSpinBox* GUI::Util::createSpinBox(QWidget* parent, const UIntDescriptor& d,
return spinBox;
}
DoubleSpinBox* GUI::Util::createSpinBox(QFormLayout* parentLayout, const DoubleDescriptor& d)
DoubleSpinBox* GUI::Util::createSpinBox(QFormLayout* parentLayout, const DoubleDescriptor& d,
std::function<void(double)> slot)
{
auto* sb = new DoubleSpinBox(parentLayout->parentWidget(), d);
parentLayout->addRow(labelWithUnit(d.label, d.unit) + ":", sb);
if (slot)
QObject::connect(sb, &DoubleSpinBox::baseValueChanged, [=](int v) { slot(v); });
return sb;
}
......
......@@ -91,8 +91,10 @@ QSpinBox* createSpinBox(QFormLayout* parentLayout, const UIntDescriptor& d);
//!
//! No connections to update the descriptor will be established! Therefore changes in the spin box
//! will *not* be notified to the descriptor. The additional (and optional) slot can be used to be
//! notified about a value change.
DoubleSpinBox* createSpinBox(QFormLayout* parentLayout, const DoubleDescriptor& d);
//! notified about a value change (the notified new value is in the base unit of the
//! DoubleDescriptor).
DoubleSpinBox* createSpinBox(QFormLayout* parentLayout, const DoubleDescriptor& d,
std::function<void(double)> slot = nullptr);
//! Create a label with an optional unit in brackets.
//!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment