Skip to content
Snippets Groups Projects
Commit 7d0072b3 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

replace 'createDoubleSpinBoxRow' by 'addDoubleSpinBoxRow'

parent 49998433
No related branches found
No related tags found
1 merge request!2636minor
...@@ -38,8 +38,8 @@ AxisPropertyForm::AxisPropertyForm(QWidget* parent, const QString& groupTitle, ...@@ -38,8 +38,8 @@ AxisPropertyForm::AxisPropertyForm(QWidget* parent, const QString& groupTitle,
RealLimits::nonnegative(), nbinsTooltip); RealLimits::nonnegative(), nbinsTooltip);
layout->addRow("# bins:", m_nbins_spin_box); layout->addRow("# bins:", m_nbins_spin_box);
m_min_spin_box = GUI::Util::createDoubleSpinBoxRow(layout, axisProperty->min()); m_min_spin_box = GUI::Util::addDoubleSpinBoxRow(layout, axisProperty->min());
m_max_spin_box = GUI::Util::createDoubleSpinBoxRow(layout, axisProperty->max()); m_max_spin_box = GUI::Util::addDoubleSpinBoxRow(layout, axisProperty->max());
connect(m_min_spin_box, &DoubleSpinBox::valueChanged, [this](double v) { connect(m_min_spin_box, &DoubleSpinBox::valueChanged, [this](double v) {
if (m_axis_property->min() != v) { if (m_axis_property->min() != v) {
......
...@@ -47,7 +47,7 @@ void BackgroundForm::createBackgroundWidgets() ...@@ -47,7 +47,7 @@ void BackgroundForm::createBackgroundWidgets()
auto* backgroundItem = m_instrument->backgroundItem(); auto* backgroundItem = m_instrument->backgroundItem();
if (auto* p = dynamic_cast<ConstantBackgroundItem*>(backgroundItem)) { if (auto* p = dynamic_cast<ConstantBackgroundItem*>(backgroundItem)) {
auto* sb = GUI::Util::createDoubleSpinBoxRow(m_form_layout, p->backgroundValue()); auto* sb = GUI::Util::addDoubleSpinBoxRow(m_form_layout, p->backgroundValue());
sb->setMinimumWidth(150); sb->setMinimumWidth(150);
connect(sb, &DoubleSpinBox::valueChanged, [this, p](double v) { connect(sb, &DoubleSpinBox::valueChanged, [this, p](double v) {
p->setBackgroundValue(v); p->setBackgroundValue(v);
......
...@@ -60,8 +60,8 @@ DetectorEditor::DetectorEditor(QWidget* parent, Scatter2DInstrumentItem* instrIt ...@@ -60,8 +60,8 @@ DetectorEditor::DetectorEditor(QWidget* parent, Scatter2DInstrumentItem* instrIt
auto* resFunction = item->resolutionFunctionSelection().certainItem(); auto* resFunction = item->resolutionFunctionSelection().certainItem();
if (auto* p = dynamic_cast<ResolutionFunction2DGaussianItem*>(resFunction)) { if (auto* p = dynamic_cast<ResolutionFunction2DGaussianItem*>(resFunction)) {
auto* sigmaXSpinBox = GUI::Util::createDoubleSpinBoxRow(layout, p->sigmaX()); auto* sigmaXSpinBox = GUI::Util::addDoubleSpinBoxRow(layout, p->sigmaX());
auto* sigmaYSpinBox = GUI::Util::createDoubleSpinBoxRow(layout, p->sigmaY()); auto* sigmaYSpinBox = GUI::Util::addDoubleSpinBoxRow(layout, p->sigmaY());
connect(sigmaXSpinBox, &DoubleSpinBox::valueChanged, [parent, p](double newValue) { connect(sigmaXSpinBox, &DoubleSpinBox::valueChanged, [parent, p](double newValue) {
p->setSigmaX(newValue); p->setSigmaX(newValue);
......
...@@ -111,7 +111,7 @@ void DistributionSelector::createNumSamplesSpinBox(DistributionItem* dist) ...@@ -111,7 +111,7 @@ void DistributionSelector::createNumSamplesSpinBox(DistributionItem* dist)
DoubleSpinBox* DistributionSelector::createSpinBox(DoubleProperty& d) DoubleSpinBox* DistributionSelector::createSpinBox(DoubleProperty& d)
{ {
auto* sb = GUI::Util::createDoubleSpinBoxRow(m_form_layout, d); auto* sb = GUI::Util::addDoubleSpinBoxRow(m_form_layout, d);
connect(sb, &DoubleSpinBox::valueChanged, [this, &d](double v) { connect(sb, &DoubleSpinBox::valueChanged, [this, &d](double v) {
d.setValue(v); d.setValue(v);
emit distributionChanged(); emit distributionChanged();
...@@ -123,7 +123,7 @@ void DistributionSelector::createMeanSpinBox(DoubleProperty& d) ...@@ -123,7 +123,7 @@ void DistributionSelector::createMeanSpinBox(DoubleProperty& d)
{ {
if (m_mean_config) { if (m_mean_config) {
if (m_mean_config->scientific) { if (m_mean_config->scientific) {
auto* sb = GUI::Util::createDoubleSpinBoxRow(m_form_layout, d); auto* sb = GUI::Util::addDoubleSpinBoxRow(m_form_layout, d);
connect(sb, &DoubleSpinBox::valueChanged, [this, &d](double v) { connect(sb, &DoubleSpinBox::valueChanged, [this, &d](double v) {
d.setValue(v); d.setValue(v);
emit distributionChanged(); emit distributionChanged();
......
...@@ -48,14 +48,14 @@ void FootprintForm::updateFootprintWidgets() ...@@ -48,14 +48,14 @@ void FootprintForm::updateFootprintWidgets()
int sb_width = 134; int sb_width = 134;
auto* footprintItem = m_item->footprintSelection().certainItem(); auto* footprintItem = m_item->footprintSelection().certainItem();
if (auto* sqr = dynamic_cast<FootprintSquareItem*>(footprintItem)) { if (auto* sqr = dynamic_cast<FootprintSquareItem*>(footprintItem)) {
auto* sb = GUI::Util::createDoubleSpinBoxRow(m_form_layout, sqr->squareFootprintValue()); auto* sb = GUI::Util::addDoubleSpinBoxRow(m_form_layout, sqr->squareFootprintValue());
sb->setMinimumWidth(sb_width); sb->setMinimumWidth(sb_width);
connect(sb, &DoubleSpinBox::valueChanged, [this, sqr](double v) { connect(sb, &DoubleSpinBox::valueChanged, [this, sqr](double v) {
sqr->setSquareFootprintValue(v); sqr->setSquareFootprintValue(v);
emit dataChanged(); emit dataChanged();
}); });
} else if (auto* gs = dynamic_cast<FootprintGaussianItem*>(footprintItem)) { } else if (auto* gs = dynamic_cast<FootprintGaussianItem*>(footprintItem)) {
auto* sb = GUI::Util::createDoubleSpinBoxRow(m_form_layout, gs->gaussianFootprintValue()); auto* sb = GUI::Util::addDoubleSpinBoxRow(m_form_layout, gs->gaussianFootprintValue());
sb->setMinimumWidth(sb_width); sb->setMinimumWidth(sb_width);
connect(sb, &DoubleSpinBox::valueChanged, [this, gs](double v) { connect(sb, &DoubleSpinBox::valueChanged, [this, gs](double v) {
gs->setGaussianFootprintValue(v); gs->setGaussianFootprintValue(v);
......
...@@ -39,8 +39,8 @@ SpanPropertyForm::SpanPropertyForm(QWidget* parent, const QString& group_title, ...@@ -39,8 +39,8 @@ SpanPropertyForm::SpanPropertyForm(QWidget* parent, const QString& group_title,
RealLimits::limited(1, 1 << 15), nbins_tooltip, &m_updaters); RealLimits::limited(1, 1 << 15), nbins_tooltip, &m_updaters);
layout->addRow("# bins:", m_nbins_spin_box); layout->addRow("# bins:", m_nbins_spin_box);
m_width_spin_box = GUI::Util::createDoubleSpinBoxRow(layout, m_span_property->width()); m_width_spin_box = GUI::Util::addDoubleSpinBoxRow(layout, m_span_property->width());
m_center_spin_box = GUI::Util::createDoubleSpinBoxRow(layout, m_span_property->center()); m_center_spin_box = GUI::Util::addDoubleSpinBoxRow(layout, m_span_property->center());
connect(m_width_spin_box, &DoubleSpinBox::valueChanged, [this](double v) { connect(m_width_spin_box, &DoubleSpinBox::valueChanged, [this](double v) {
ASSERT(v >= 0); // spin box should have got limits from property ASSERT(v >= 0); // spin box should have got limits from property
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
DoubleSpinBox* GUI::Util::createDoubleSpinBoxRow(QFormLayout* parentLayout, DoubleProperty& d) DoubleSpinBox* GUI::Util::addDoubleSpinBoxRow(QFormLayout* parentLayout, DoubleProperty& d)
{ {
auto* sb = new DoubleSpinBox(&d); auto* sb = new DoubleSpinBox(&d);
parentLayout->addRow(d.label() + ":", sb); parentLayout->addRow(d.label() + ":", sb);
......
...@@ -37,7 +37,7 @@ namespace GUI::Util { ...@@ -37,7 +37,7 @@ namespace GUI::Util {
//! //!
//! No connections to update the property will be established! Therefore changes in the spin box //! No connections to update the property will be established! Therefore changes in the spin box
//! will *not* be notified to the property. //! will *not* be notified to the property.
DoubleSpinBox* createDoubleSpinBoxRow(QFormLayout* parentLayout, DoubleProperty& d); DoubleSpinBox* addDoubleSpinBoxRow(QFormLayout* parentLayout, DoubleProperty& d);
//! Creates an updatable checkbox //! Creates an updatable checkbox
QCheckBox* createCheckBox(const QString& title, std::function<bool()> getter, QCheckBox* createCheckBox(const QString& title, std::function<bool()> getter,
......
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