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