diff --git a/GUI/View/Device/AxisPropertyForm.cpp b/GUI/View/Device/AxisPropertyForm.cpp index 4b58b08e5986ccedaad31d22b819e93e0650ba84..7578652240427acbd8357372afb049844523a3c7 100644 --- a/GUI/View/Device/AxisPropertyForm.cpp +++ b/GUI/View/Device/AxisPropertyForm.cpp @@ -29,7 +29,7 @@ AxisPropertyForm::AxisPropertyForm(QWidget* parent, const QString& groupTitle, layout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint); - m_nbinsSpinBox = GUI::Util::createIntSpinbox([axisProperty] { return axisProperty->nbins(); }, + m_nbinsSpinBox = GUI::Util::createIntSpinBox([axisProperty] { return axisProperty->nbins(); }, [this, axisProperty](int v) { axisProperty->setNbins(v); emit dataChanged(); diff --git a/GUI/View/Device/SpanPropertyForm.cpp b/GUI/View/Device/SpanPropertyForm.cpp index c4b34798b16aea48319ff32ed3b07209f3ad9b76..96242415084962c038611f00e57e06017b36b16a 100644 --- a/GUI/View/Device/SpanPropertyForm.cpp +++ b/GUI/View/Device/SpanPropertyForm.cpp @@ -30,7 +30,7 @@ SpanPropertyForm::SpanPropertyForm(QWidget* parent, const QString& groupTitle, layout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint); - m_nbinsSpinBox = GUI::Util::createIntSpinbox([spanProperty] { return spanProperty->nbins(); }, + m_nbinsSpinBox = GUI::Util::createIntSpinBox([spanProperty] { return spanProperty->nbins(); }, [this, spanProperty](int v) { spanProperty->setNbins(v); emit dataChanged(); diff --git a/GUI/View/FitControl/MinimizerSettingsWidget.cpp b/GUI/View/FitControl/MinimizerSettingsWidget.cpp index 53a960b734ebe8227eb9e0614f00758d2ded41f6..300b17b692dd31fe61b73ac2f6267e1703f6b730 100644 --- a/GUI/View/FitControl/MinimizerSettingsWidget.cpp +++ b/GUI/View/FitControl/MinimizerSettingsWidget.cpp @@ -185,7 +185,7 @@ void MinimizerSettingsWidget::createMinuitEdits() m_minimizerLayout->addRow( "Strategy:", - GUI::Util::createIntSpinbox([=] { return minItem->strategy(); }, + GUI::Util::createIntSpinBox([=] { return minItem->strategy(); }, [=](int v) { minItem->setStrategy(v); gProjectDocument.value()->setModified(); @@ -196,7 +196,7 @@ void MinimizerSettingsWidget::createMinuitEdits() m_minimizerLayout->addRow( "ErrorDef factor:", - GUI::Util::createDoubleSpinbox([=] { return minItem->errorDefinition(); }, + GUI::Util::createDoubleSpinBox([=] { return minItem->errorDefinition(); }, [=](double v) { minItem->setErrorDefinition(v); gProjectDocument.value()->setModified(); @@ -206,7 +206,7 @@ void MinimizerSettingsWidget::createMinuitEdits() RealLimits::positive())); m_minimizerLayout->addRow("Tolerance:", - GUI::Util::createDoubleSpinbox( + GUI::Util::createDoubleSpinBox( [=] { return minItem->tolerance(); }, [=](double v) { minItem->setTolerance(v); @@ -217,7 +217,7 @@ void MinimizerSettingsWidget::createMinuitEdits() m_minimizerLayout->addRow( "Precision:", - GUI::Util::createDoubleSpinbox([=] { return minItem->precision(); }, + GUI::Util::createDoubleSpinBox([=] { return minItem->precision(); }, [=](double v) { minItem->setPrecision(v); gProjectDocument.value()->setModified(); @@ -227,7 +227,7 @@ void MinimizerSettingsWidget::createMinuitEdits() m_minimizerLayout->addRow( "Max func calls:", - GUI::Util::createIntSpinbox([=] { return minItem->maxFuncCalls(); }, + GUI::Util::createIntSpinBox([=] { return minItem->maxFuncCalls(); }, [=](int v) { minItem->setMaxFuncCalls(v); gProjectDocument.value()->setModified(); @@ -242,7 +242,7 @@ void MinimizerSettingsWidget::createGSLMultiMinEdits() m_minimizerLayout->addRow( "Max iterations:", - GUI::Util::createIntSpinbox([=] { return minItem->maxIterations(); }, + GUI::Util::createIntSpinBox([=] { return minItem->maxIterations(); }, [=](int v) { minItem->setMaxIterations(v); gProjectDocument.value()->setModified(); @@ -256,7 +256,7 @@ void MinimizerSettingsWidget::createTMVAGeneticEdits() GeneticMinimizerItem* minItem = m_containerItem->minimizerItemGenetic(); m_minimizerLayout->addRow("Tolerance:", - GUI::Util::createDoubleSpinbox( + GUI::Util::createDoubleSpinBox( [=] { return minItem->tolerance(); }, [=](double v) { minItem->setTolerance(v); @@ -267,7 +267,7 @@ void MinimizerSettingsWidget::createTMVAGeneticEdits() m_minimizerLayout->addRow( "Max iterations:", - GUI::Util::createIntSpinbox([=] { return minItem->maxIterations(); }, + GUI::Util::createIntSpinBox([=] { return minItem->maxIterations(); }, [=](int v) { minItem->setMaxIterations(v); gProjectDocument.value()->setModified(); @@ -276,7 +276,7 @@ void MinimizerSettingsWidget::createTMVAGeneticEdits() &m_updaters, true /*easy scroll*/)); m_minimizerLayout->addRow( - "Population:", GUI::Util::createIntSpinbox([=] { return minItem->populationSize(); }, + "Population:", GUI::Util::createIntSpinBox([=] { return minItem->populationSize(); }, [=](int v) { minItem->setPopulationSize(v); gProjectDocument.value()->setModified(); @@ -284,7 +284,7 @@ void MinimizerSettingsWidget::createTMVAGeneticEdits() RealLimits::nonnegative(), "Population size", &m_updaters, true /*easy scroll*/)); - m_minimizerLayout->addRow("Random seed:", GUI::Util::createIntSpinbox( + m_minimizerLayout->addRow("Random seed:", GUI::Util::createIntSpinBox( [=] { return minItem->randomSeed(); }, [=](int v) { minItem->setRandomSeed(v); @@ -300,7 +300,7 @@ void MinimizerSettingsWidget::createGSLSimulatedAnnealingEdits() SimAnMinimizerItem* minItem = m_containerItem->minimizerItemSimAn(); m_minimizerLayout->addRow( - "Max iterations:", GUI::Util::createIntSpinbox([=] { return minItem->maxIterations(); }, + "Max iterations:", GUI::Util::createIntSpinBox([=] { return minItem->maxIterations(); }, [=](int v) { minItem->setMaxIterations(v); gProjectDocument.value()->setModified(); @@ -311,7 +311,7 @@ void MinimizerSettingsWidget::createGSLSimulatedAnnealingEdits() m_minimizerLayout->addRow( "Iterations at T:", - GUI::Util::createIntSpinbox([=] { return minItem->iterationsAtEachTemp(); }, + GUI::Util::createIntSpinBox([=] { return minItem->iterationsAtEachTemp(); }, [=](int v) { minItem->setIterationsAtEachTemp(v); gProjectDocument.value()->setModified(); @@ -320,7 +320,7 @@ void MinimizerSettingsWidget::createGSLSimulatedAnnealingEdits() "Number of iterations at each temperature", &m_updaters, true /*easy scroll*/)); - m_minimizerLayout->addRow("Step size:", GUI::Util::createDoubleSpinbox( + m_minimizerLayout->addRow("Step size:", GUI::Util::createDoubleSpinBox( [=] { return minItem->stepSize(); }, [=](double v) { minItem->setStepSize(v); @@ -329,7 +329,7 @@ void MinimizerSettingsWidget::createGSLSimulatedAnnealingEdits() &m_updaters, "Max step size used in random walk", RealLimits::nonnegative())); - m_minimizerLayout->addRow("k:", GUI::Util::createDoubleSpinbox( + m_minimizerLayout->addRow("k:", GUI::Util::createDoubleSpinBox( [=] { return minItem->boltzmanK(); }, [=](double v) { minItem->setBoltzmanK(v); @@ -338,7 +338,7 @@ void MinimizerSettingsWidget::createGSLSimulatedAnnealingEdits() &m_updaters, "Boltzmann k", RealLimits::nonnegative())); m_minimizerLayout->addRow( - "T init:", GUI::Util::createDoubleSpinbox([=] { return minItem->boltzmanInitT(); }, + "T init:", GUI::Util::createDoubleSpinBox([=] { return minItem->boltzmanInitT(); }, [=](double v) { minItem->setBoltzmanInitT(v); gProjectDocument.value()->setModified(); @@ -346,7 +346,7 @@ void MinimizerSettingsWidget::createGSLSimulatedAnnealingEdits() &m_updaters, "Boltzmann initial temperature", RealLimits::nonnegative())); - m_minimizerLayout->addRow("mu:", GUI::Util::createDoubleSpinbox( + m_minimizerLayout->addRow("mu:", GUI::Util::createDoubleSpinBox( [=] { return minItem->boltzmanMu(); }, [=](double v) { minItem->setBoltzmanMu(v); @@ -355,7 +355,7 @@ void MinimizerSettingsWidget::createGSLSimulatedAnnealingEdits() &m_updaters, "Boltzmann mu", RealLimits::nonnegative())); m_minimizerLayout->addRow( - "T min:", GUI::Util::createDoubleSpinbox([=] { return minItem->boltzmanMinT(); }, + "T min:", GUI::Util::createDoubleSpinBox([=] { return minItem->boltzmanMinT(); }, [=](double v) { minItem->setBoltzmanMinT(v); gProjectDocument.value()->setModified(); @@ -369,7 +369,7 @@ void MinimizerSettingsWidget::createGSLLevMarEdits() GSLLMAMinimizerItem* minItem = m_containerItem->minimizerItemGSLLMA(); m_minimizerLayout->addRow("Tolerance:", - GUI::Util::createDoubleSpinbox( + GUI::Util::createDoubleSpinBox( [=] { return minItem->tolerance(); }, [=](double v) { minItem->setTolerance(v); @@ -380,7 +380,7 @@ void MinimizerSettingsWidget::createGSLLevMarEdits() m_minimizerLayout->addRow( "Max iterations:", - GUI::Util::createIntSpinbox([=] { return minItem->maxIterations(); }, + GUI::Util::createIntSpinBox([=] { return minItem->maxIterations(); }, [=](int v) { minItem->setMaxIterations(v); gProjectDocument.value()->setModified(); diff --git a/GUI/View/Instrument/DistributionSelector.cpp b/GUI/View/Instrument/DistributionSelector.cpp index a1ed0b529d6bf132c8557e0dab61907a854c4366..8d694d8b6e8d04379ae33cfb8f322043bce7f0d4 100644 --- a/GUI/View/Instrument/DistributionSelector.cpp +++ b/GUI/View/Instrument/DistributionSelector.cpp @@ -57,18 +57,18 @@ void DistributionSelector::createDistributionWidgets() createSpinBox(it->hwhm()); createNumSamplesSpinBox(it); } else if (auto* it = dynamic_cast<DistributionGateItem*>(m_item->distributionItem())) { - auto* minSpinbox = createSpinBox(it->minimum()); - auto* maxSpinbox = createSpinBox(it->maximum()); - connect(minSpinbox, &DoubleSpinBox::baseValueChanged, [it, maxSpinbox](double d) { + auto* minSpinBox = createSpinBox(it->minimum()); + auto* maxSpinBox = createSpinBox(it->maximum()); + connect(minSpinBox, &DoubleSpinBox::baseValueChanged, [it, maxSpinBox](double d) { if (d > it->maximum()) { it->setMaximum(d); - maxSpinbox->updateValue(); + maxSpinBox->updateValue(); } }); - connect(maxSpinbox, &DoubleSpinBox::baseValueChanged, [it, minSpinbox](double d) { + connect(maxSpinBox, &DoubleSpinBox::baseValueChanged, [it, minSpinBox](double d) { if (d < it->minimum()) { it->setMinimum(d); - minSpinbox->updateValue(); + minSpinBox->updateValue(); } }); createNumSamplesSpinBox(it); @@ -102,7 +102,7 @@ void DistributionSelector::createNumSamplesSpinBox(DistributionItem* dist) { ASSERT(dist); m_formLayout->addRow("Number of samples:", - GUI::Util::createIntSpinbox([dist] { return dist->numberOfSamples(); }, + GUI::Util::createIntSpinBox([dist] { return dist->numberOfSamples(); }, [this, dist](int v) { dist->setNumberOfSamples(v); emit distributionChanged(); diff --git a/GUI/View/Instrument/DistributionSelector.h b/GUI/View/Instrument/DistributionSelector.h index 1f01e86e1fb033849c52c07266130b23871f277d..0bfac960dc293b90e8747f6ef68ff7d722621d23 100644 --- a/GUI/View/Instrument/DistributionSelector.h +++ b/GUI/View/Instrument/DistributionSelector.h @@ -25,7 +25,6 @@ class BeamDistributionItem; class DistributionItem; class DoubleProperty; class DoubleSpinBox; -class ScientificSpinBox; //! configuration to control how the user can enter a mean value struct MeanConfig { diff --git a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp index 702429c4ee08cf045cfde869917e2f5203cce72b..16b9f49027179e99acce10f1f31706f65b081556 100644 --- a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp +++ b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp @@ -156,10 +156,10 @@ MaterialEditorDialog::MaterialEditorDialog(SampleItem* sample, QWidget* parent) configScientificDoubleEdit(m_realEdit, RealLimits::limitless()); configScientificDoubleEdit(m_imaginaryEdit, RealLimits::limitless()); - using GUI::View::NumberUtil::configSpinbox; - configSpinbox(m_xSpinBox, 3, RealLimits::limitless()); - configSpinbox(m_ySpinBox, 3, RealLimits::limitless()); - configSpinbox(m_zSpinBox, 3, RealLimits::limitless()); + using GUI::View::NumberUtil::configSpinBox; + configSpinBox(m_xSpinBox, 3, RealLimits::limitless()); + configSpinBox(m_ySpinBox, 3, RealLimits::limitless()); + configSpinBox(m_zSpinBox, 3, RealLimits::limitless()); // Setting z-component is temporary disabled (see issue #654) // When implemented, rm disabling diff --git a/GUI/View/Numeric/DoubleSpinBox.cpp b/GUI/View/Numeric/DoubleSpinBox.cpp index 8f963a35909eda0ed86f6b641bd893e0736a1ea7..5e6759c8c080b661c248f79d1f35dc701115ae03 100644 --- a/GUI/View/Numeric/DoubleSpinBox.cpp +++ b/GUI/View/Numeric/DoubleSpinBox.cpp @@ -22,7 +22,7 @@ DoubleSpinBox::DoubleSpinBox(const DoubleProperty& d, bool easyScrollable, QWidg , m_easyScrollable(easyScrollable) { setFocusPolicy(Qt::StrongFocus); - GUI::View::NumberUtil::configSpinbox(this, d.decimals(), d.limits()); + GUI::View::NumberUtil::configSpinBox(this, d.decimals(), d.limits()); setToolTip(d.tooltip()); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); diff --git a/GUI/View/Numeric/NumWidgetUtil.cpp b/GUI/View/Numeric/NumWidgetUtil.cpp index f69ab4abcfc6d87bd47097630ac89b0c49778dbc..d26125076f00eefc262db2d278352cb560979f57 100644 --- a/GUI/View/Numeric/NumWidgetUtil.cpp +++ b/GUI/View/Numeric/NumWidgetUtil.cpp @@ -35,7 +35,7 @@ ScientificSpinBox* GUI::Util::createScientificSpinBox(QFormLayout* parentLayout, { auto* spinBox = new ScientificSpinBox(parentLayout->parentWidget()); spinBox->setFocusPolicy(Qt::StrongFocus); - GUI::View::NumberUtil::configSpinbox(spinBox, d.decimals(), d.limits()); + GUI::View::NumberUtil::configSpinBox(spinBox, d.decimals(), d.limits()); spinBox->setToolTip(d.tooltip()); spinBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); spinBox->setValue(d.value()); @@ -61,7 +61,7 @@ QCheckBox* GUI::Util::createCheckBox(const QString& title, function<bool()> gett return checkBox; } -QSpinBox* GUI::Util::createIntSpinbox(function<int()> getter, function<void(int)> slot, +QSpinBox* GUI::Util::createIntSpinBox(function<int()> getter, function<void(int)> slot, const RealLimits& limits, QString tooltip, QList<function<void()>>* updaters, bool easyScrollable) { @@ -89,7 +89,7 @@ QSpinBox* GUI::Util::createIntSpinbox(function<int()> getter, function<void(int) return spin; } -QDoubleSpinBox* GUI::Util::createDoubleSpinbox(function<double()> getter, +QDoubleSpinBox* GUI::Util::createDoubleSpinBox(function<double()> getter, function<void(double)> slot, QList<function<void()>>* updaters, QString tooltip, const RealLimits& limits, bool easyScrollable) diff --git a/GUI/View/Numeric/NumWidgetUtil.h b/GUI/View/Numeric/NumWidgetUtil.h index 125c158d55419a7b4440448dfed6188afcf7cb8e..c8c64c948b0d1227fd3f034a2c4b9a771e421519 100644 --- a/GUI/View/Numeric/NumWidgetUtil.h +++ b/GUI/View/Numeric/NumWidgetUtil.h @@ -66,13 +66,13 @@ QCheckBox* createCheckBox(const QString& title, std::function<bool()> getter, //! "easyScrollable" flag is false. Otherwise it would be dangerous if the spin box is on a //! scrollable form - unintended and unnoticed changes would take place when just scrolling through //! the form. -QSpinBox* createIntSpinbox(std::function<int()> getter, std::function<void(int)> slot, +QSpinBox* createIntSpinBox(std::function<int()> getter, std::function<void(int)> slot, const RealLimits& limits = {}, QString tooltip = "", QList<std::function<void()>>* updaters = nullptr, bool easyScrollable = false); //! Creates a scrollable updatable doublespinBox -QDoubleSpinBox* createDoubleSpinbox(std::function<double()> getter, +QDoubleSpinBox* createDoubleSpinBox(std::function<double()> getter, std::function<void(double)> slot, QList<std::function<void()>>* updaters, QString tooltip = "", const RealLimits& limits = {}, bool easyScrollable = true); diff --git a/GUI/View/Numeric/NumberUtil.cpp b/GUI/View/Numeric/NumberUtil.cpp index f5ada5aeadb848c8874822f97285520e63731bce..fec67e982cee412ea949e9682e5b8e1256ad9c7f 100644 --- a/GUI/View/Numeric/NumberUtil.cpp +++ b/GUI/View/Numeric/NumberUtil.cpp @@ -41,7 +41,7 @@ void GUI::View::NumberUtil::configScientificDoubleEdit(QLineEdit* edit, const Re edit->setValidator(validator); } -void GUI::View::NumberUtil::configSpinbox(QDoubleSpinBox* spinBox, int decimals, +void GUI::View::NumberUtil::configSpinBox(QDoubleSpinBox* spinBox, int decimals, const RealLimits& limits) { spinBox->setMaximum(std::numeric_limits<double>::max()); @@ -56,7 +56,7 @@ void GUI::View::NumberUtil::configSpinbox(QDoubleSpinBox* spinBox, int decimals, spinBox->setSingleStep(singleStep(decimals)); } -void GUI::View::NumberUtil::configSpinbox(ScientificSpinBox* spinBox, int decimals, +void GUI::View::NumberUtil::configSpinBox(ScientificSpinBox* spinBox, int decimals, const RealLimits& limits) { spinBox->setMaximum(std::numeric_limits<double>::max()); diff --git a/GUI/View/Numeric/NumberUtil.h b/GUI/View/Numeric/NumberUtil.h index a11cfa97694b82cf86c8656e34940f877e8d2afa..3ab53b96b64a820f7eb8e064c65439859e85d2d4 100644 --- a/GUI/View/Numeric/NumberUtil.h +++ b/GUI/View/Numeric/NumberUtil.h @@ -26,8 +26,8 @@ namespace GUI::View::NumberUtil { void configScientificDoubleEdit(QLineEdit* edit, const RealLimits& limits); -void configSpinbox(QDoubleSpinBox* spinBox, int decimals, const RealLimits& limits); -void configSpinbox(ScientificSpinBox* spinBox, int decimals, const RealLimits& limits); +void configSpinBox(QDoubleSpinBox* spinBox, int decimals, const RealLimits& limits); +void configSpinBox(ScientificSpinBox* spinBox, int decimals, const RealLimits& limits); } // namespace GUI::View::NumberUtil diff --git a/GUI/View/Numeric/SafeSpinBox.h b/GUI/View/Numeric/SafeSpinBox.h index 7c4578f51909be14b56157c30a337b36e33a4a33..977638ed1d16a2677614059b73c12e02e1c3008c 100644 --- a/GUI/View/Numeric/SafeSpinBox.h +++ b/GUI/View/Numeric/SafeSpinBox.h @@ -17,7 +17,7 @@ #include <QSpinBox> -//! Spinbox that enables scrolling only on focus +//! SpinBox that enables scrolling only on focus class SafeSpinBox : public QSpinBox { Q_OBJECT diff --git a/GUI/View/Sample/CoreAndShellForm.cpp b/GUI/View/Sample/CoreAndShellForm.cpp index 6e21c66238ae7d8fd35f07fe7b6b734d945789bb..51a79e1d6b33f23e685c00d3b5ddf99d4c968220 100644 --- a/GUI/View/Sample/CoreAndShellForm.cpp +++ b/GUI/View/Sample/CoreAndShellForm.cpp @@ -173,7 +173,7 @@ void CoreAndShellForm::createCoreWidgets() const QString formfactor = FormFactorItemCatalog::menuEntry(particle->formFactorItem()); groupTitle += " (" + formfactor + ")"; - core.layout->addBoldRow("Material", new MaterialInplaceForm(this, particle, m_ec)); + core.layout->addBoldRow("Material", new MaterialInplaceForm(particle, m_ec)); core.layout->addGroupOfValues("Geometry", particle->formFactorItem()->geometryProperties()); core.layout->addVector(particle->position(), false); core.layout->addSelection(particle->rotationSelection()); @@ -189,7 +189,7 @@ void CoreAndShellForm::createShellWidgets() const QString formfactor = FormFactorItemCatalog::menuEntry(particle->formFactorItem()); groupTitle += " (" + formfactor + ")"; - shell.layout->addBoldRow("Material", new MaterialInplaceForm(this, particle, m_ec)); + shell.layout->addBoldRow("Material", new MaterialInplaceForm(particle, m_ec)); shell.layout->addGroupOfValues("Geometry", particle->formFactorItem()->geometryProperties()); shell.layout->addSelection(particle->rotationSelection()); diff --git a/GUI/View/Sample/InterferenceForm.cpp b/GUI/View/Sample/InterferenceForm.cpp index 1caacf72c13e3c9be8c5df03278e4daa74d0ba43..3f6c294660e08c8588fdc72733f9a62373c516f8 100644 --- a/GUI/View/Sample/InterferenceForm.cpp +++ b/GUI/View/Sample/InterferenceForm.cpp @@ -99,7 +99,7 @@ void InterferenceForm::createInterferenceWidgets() } else if (auto* itf = dynamic_cast<InterferenceFinite2DLatticeItem*>(interference)) { m_layout->addValue(itf->positionVariance()); m_layout->addBoldRow("Domain size 1:", - GUI::Util::createIntSpinbox([itf] { return itf->domainSize1(); }, + GUI::Util::createIntSpinBox([itf] { return itf->domainSize1(); }, [this, itf](int v) { itf->setDomainSize1(v); emit m_ec->modified(); @@ -107,7 +107,7 @@ void InterferenceForm::createInterferenceWidgets() RealLimits::lowerLimited(1), "Domain size 1 in number of unit cells")); m_layout->addBoldRow("Domain size 2:", - GUI::Util::createIntSpinbox([itf] { return itf->domainSize2(); }, + GUI::Util::createIntSpinBox([itf] { return itf->domainSize2(); }, [this, itf](int v) { itf->setDomainSize2(v); emit m_ec->modified(); diff --git a/GUI/View/Sample/LayerEditorUtil.cpp b/GUI/View/Sample/LayerEditorUtil.cpp index 8af34f21e4eb6095c941efd2a384cb4a408c07f0..5e3877cab11006db9bb00ba4b6f1a2f8f1f403bd 100644 --- a/GUI/View/Sample/LayerEditorUtil.cpp +++ b/GUI/View/Sample/LayerEditorUtil.cpp @@ -19,7 +19,6 @@ #include "GUI/Model/Sample/CoreAndShellItem.h" #include "GUI/Model/Sample/MesocrystalItem.h" #include "GUI/Model/Sample/ParticleItem.h" -#include "GUI/View/Numeric/DoubleLineEdit.h" #include "GUI/View/Numeric/DoubleSpinBox.h" #include "GUI/View/Sample/CompoundForm.h" #include "GUI/View/Sample/CoreAndShellForm.h" diff --git a/GUI/View/Sample/LayerForm.cpp b/GUI/View/Sample/LayerForm.cpp index 3c9ab5d2712038c1247fa2093a840d833153365b..71dca5ff23d0a98b75832f1c0d71468014762fdc 100644 --- a/GUI/View/Sample/LayerForm.cpp +++ b/GUI/View/Sample/LayerForm.cpp @@ -94,10 +94,10 @@ LayerForm::LayerForm(QWidget* parent, LayerItem* layerItem, SampleEditorControll QColor bckgroundCol = m_layer->color(); setStyleSheet("LayerForm {background-color: " + bckgroundCol.name(QColor::HexRgb) + "}"); - m_layout->addBoldRow("Material:", new MaterialInplaceForm(this, layerItem, ec)); + m_layout->addBoldRow("Material:", new MaterialInplaceForm(layerItem, ec)); m_layout->addValue(m_layer->thickness()); - m_layout->addBoldRow("Number of slices:", GUI::Util::createIntSpinbox( + m_layout->addBoldRow("Number of slices:", GUI::Util::createIntSpinBox( [this] { return m_layer->numSlices(); }, [this](int v) { m_layer->setNumSlices(v); diff --git a/GUI/View/Sample/MaterialInplaceForm.cpp b/GUI/View/Sample/MaterialInplaceForm.cpp index ea54d6dc751b7fae39586a5c9031f1b1ba0921e7..74835f1a7fc20914d0ebce23a1027967c02deb96 100644 --- a/GUI/View/Sample/MaterialInplaceForm.cpp +++ b/GUI/View/Sample/MaterialInplaceForm.cpp @@ -31,10 +31,8 @@ #include <QLabel> #include <QPushButton> -MaterialInplaceForm::MaterialInplaceForm(QWidget* parent, ItemWithMaterial* item, - SampleEditorController* ec) - : QWidget(parent) - , m_item(item) +MaterialInplaceForm::MaterialInplaceForm(ItemWithMaterial* item, SampleEditorController* ec) + : m_item(item) , m_ec(ec) , m_layout(new QGridLayout(this)) { @@ -42,7 +40,7 @@ MaterialInplaceForm::MaterialInplaceForm(QWidget* parent, ItemWithMaterial* item createWidgets(); connect(itemWithMaterial()->materialItem(), &MaterialItem::dataChanged, this, - &MaterialInplaceForm::onMaterialChanged); + &MaterialInplaceForm::updateValues); } ItemWithMaterial* MaterialInplaceForm::itemWithMaterial() const @@ -74,7 +72,7 @@ void MaterialInplaceForm::selectMaterial() m_ec->selectMaterial(m_item, newMaterialIdentifier); createWidgets(); connect(itemWithMaterial()->materialItem(), &MaterialItem::dataChanged, this, - &MaterialInplaceForm::onMaterialChanged); + &MaterialInplaceForm::updateValues); } else { updateValues(); // necessary, since in the material editor the values could have been // changed without selecting a different material @@ -136,8 +134,3 @@ void MaterialInplaceForm::createWidgets() m_layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), 0, m_layout->columnCount()); } - -void MaterialInplaceForm::onMaterialChanged() -{ - updateValues(); -} diff --git a/GUI/View/Sample/MaterialInplaceForm.h b/GUI/View/Sample/MaterialInplaceForm.h index 5d00b3e0038114e106e37451cc28e2b6e54b85ca..93abaa0a3d62430d1de75f4f60a4005c351cff7a 100644 --- a/GUI/View/Sample/MaterialInplaceForm.h +++ b/GUI/View/Sample/MaterialInplaceForm.h @@ -25,7 +25,7 @@ class SampleEditorController; class MaterialInplaceForm : public QWidget { Q_OBJECT public: - MaterialInplaceForm(QWidget* parent, ItemWithMaterial* item, SampleEditorController* ec); + MaterialInplaceForm(ItemWithMaterial* item, SampleEditorController* ec); ItemWithMaterial* itemWithMaterial() const; void updateValues(); @@ -33,7 +33,6 @@ public: private: void selectMaterial(); void createWidgets(); - void onMaterialChanged(); ItemWithMaterial* m_item; SampleEditorController* m_ec; diff --git a/GUI/View/Sample/ParticleForm.cpp b/GUI/View/Sample/ParticleForm.cpp index 7a28b59891c029f000bae64e8d1b2467bddd2b08..e3dcb6e6c3f8bcce2e52e2ba551fcde72e6f6b9e 100644 --- a/GUI/View/Sample/ParticleForm.cpp +++ b/GUI/View/Sample/ParticleForm.cpp @@ -37,7 +37,7 @@ ParticleForm::ParticleForm(QWidget* parent, ParticleItem* particleItem, bool all auto* layout = new HeinzFormLayout(ec); body()->setLayout(layout); - layout->addBoldRow("Material", new MaterialInplaceForm(this, particleItem, ec)); + layout->addBoldRow("Material", new MaterialInplaceForm(particleItem, ec)); layout->addGroupOfValues("Geometry", particleItem->formFactorItem()->geometryProperties()); layout->addVector(particleItem->position(), false); layout->addSelection(particleItem->rotationSelection()); diff --git a/GUI/View/Sample/SampleEditorController.cpp b/GUI/View/Sample/SampleEditorController.cpp index 3cc17663805ec6b3fe29e80d0cbf5fda76d46008..30a00cdc5aa654663213b6ff2467633bd4e3d6a9 100644 --- a/GUI/View/Sample/SampleEditorController.cpp +++ b/GUI/View/Sample/SampleEditorController.cpp @@ -25,7 +25,6 @@ #include "GUI/Model/Sample/ParticleLayoutItem.h" #include "GUI/Model/Sample/SampleItem.h" #include "GUI/Support/XML/Backup.h" -#include "GUI/View/Numeric/DoubleSpinBox.h" #include "GUI/View/Sample/CompoundForm.h" #include "GUI/View/Sample/CoreAndShellForm.h" #include "GUI/View/Sample/InterferenceForm.h" diff --git a/GUI/View/Sample/SampleForm.cpp b/GUI/View/Sample/SampleForm.cpp index 89233c6278ca6a3145746d8b228021b7db027161..cd1e3431f1c452b860b139cc3d8dc59be0fb968b 100644 --- a/GUI/View/Sample/SampleForm.cpp +++ b/GUI/View/Sample/SampleForm.cpp @@ -14,7 +14,6 @@ #include "GUI/View/Sample/SampleForm.h" #include "GUI/Model/Sample/SampleItem.h" -#include "GUI/View/Numeric/DoubleSpinBox.h" #include "GUI/View/Sample/CompoundForm.h" #include "GUI/View/Sample/CoreAndShellForm.h" #include "GUI/View/Sample/HeinzFormLayout.h" diff --git a/GUI/View/Setup/MaskEditorToolpanel.cpp b/GUI/View/Setup/MaskEditorToolpanel.cpp index d620ca0b29fde76be0171bc95eea58995155fc81..cff76bcff80e91ce42f2c878c5eee7aa0c555975 100644 --- a/GUI/View/Setup/MaskEditorToolpanel.cpp +++ b/GUI/View/Setup/MaskEditorToolpanel.cpp @@ -209,7 +209,7 @@ void MaskEditorToolpanel::addMaskSpinBox(const QString& label, function<double() function<void(double)> setter, const RealLimits& limits) { auto* spinBox = new QDoubleSpinBox; - GUI::View::NumberUtil::configSpinbox(spinBox, 3, limits); + GUI::View::NumberUtil::configSpinBox(spinBox, 3, limits); spinBox->setValue(getter()); connect(spinBox, &QDoubleSpinBox::valueChanged, this, [setter](double newVal) { diff --git a/GUI/View/Setup/Scale1DEditor.cpp b/GUI/View/Setup/Scale1DEditor.cpp index 653b499b0d2dd9329bc2d28b17d79bb6f446a214..1208d6c66db1f5c6092abb6297bab37a6ca9a276 100644 --- a/GUI/View/Setup/Scale1DEditor.cpp +++ b/GUI/View/Setup/Scale1DEditor.cpp @@ -63,7 +63,7 @@ void Scale1DEditor::createPanelElements() xFormLayout->setContentsMargins(0, 0, 0, 0); xFormLayout->setSpacing(5); - xFormLayout->addRow("Min:", GUI::Util::createDoubleSpinbox( + xFormLayout->addRow("Min:", GUI::Util::createDoubleSpinBox( [this] { return currentData1DItem()->axItemX()->min(); }, [this](double newValue) { for (auto* item : allData1DItems()) @@ -72,7 +72,7 @@ void Scale1DEditor::createPanelElements() }, &m_updaters)); - xFormLayout->addRow("Max:", GUI::Util::createDoubleSpinbox( + xFormLayout->addRow("Max:", GUI::Util::createDoubleSpinBox( [this] { return currentData1DItem()->axItemX()->max(); }, [this](double newValue) { for (auto* item : allData1DItems()) @@ -89,7 +89,7 @@ void Scale1DEditor::createPanelElements() yFormLayout->setContentsMargins(0, 0, 0, 0); yFormLayout->setSpacing(5); - auto* logRangeSpinbox = GUI::Util::createDoubleSpinbox( + auto* logRangeSpinBox = GUI::Util::createDoubleSpinBox( [this] { return currentData1DItem()->axItemY()->logRangeOrders(); }, [this](double newValue) { for (auto* item : mainData1DItems()) { @@ -100,7 +100,7 @@ void Scale1DEditor::createPanelElements() }, &m_updaters, "Dynamic range to display values", RealLimits::positive()); - yFormLayout->addRow("Min:", GUI::Util::createDoubleSpinbox( + yFormLayout->addRow("Min:", GUI::Util::createDoubleSpinBox( [this] { return currentData1DItem()->axItemY()->min(); }, [this](double newValue) { for (auto* item : mainData1DItems()) { @@ -112,7 +112,7 @@ void Scale1DEditor::createPanelElements() }, &m_updaters)); - yFormLayout->addRow("Max:", GUI::Util::createDoubleSpinbox( + yFormLayout->addRow("Max:", GUI::Util::createDoubleSpinBox( [this] { return currentData1DItem()->axItemY()->max(); }, [this](double newValue) { for (auto* item : mainData1DItems()) { @@ -126,15 +126,15 @@ void Scale1DEditor::createPanelElements() yFormLayout->addRow(GUI::Util::createCheckBox( "log10", [this] { return currentData1DItem()->axItemY()->isLogScale(); }, - [this, logRangeSpinbox](bool b) { - logRangeSpinbox->setEnabled(b); + [this, logRangeSpinBox](bool b) { + logRangeSpinBox->setEnabled(b); for (auto* item : allData1DItems()) item->axItemY()->setLogScale(b); gProjectDocument.value()->setModified(); }, &m_updaters)); - yFormLayout->addRow("Log range:", logRangeSpinbox); + yFormLayout->addRow("Log range:", logRangeSpinBox); m_mainLayout->addRow(yGroup); diff --git a/GUI/View/Setup/Scale2DEditor.cpp b/GUI/View/Setup/Scale2DEditor.cpp index f720d4f3870977ff45b9c61ba901416d37937f06..16bbc3dea0c6bde49f473571e46369afa4447f52 100644 --- a/GUI/View/Setup/Scale2DEditor.cpp +++ b/GUI/View/Setup/Scale2DEditor.cpp @@ -86,7 +86,7 @@ void Scale2DEditor::createPanelElements() xFormLayout->setContentsMargins(0, 0, 0, 0); xFormLayout->setSpacing(5); - xFormLayout->addRow("Min:", GUI::Util::createDoubleSpinbox( + xFormLayout->addRow("Min:", GUI::Util::createDoubleSpinBox( [this] { return currentData2DItem()->axItemX()->min(); }, [this](double newValue) { for (auto* item : allData2DItems()) @@ -95,7 +95,7 @@ void Scale2DEditor::createPanelElements() }, &m_updaters)); - xFormLayout->addRow("Max:", GUI::Util::createDoubleSpinbox( + xFormLayout->addRow("Max:", GUI::Util::createDoubleSpinBox( [this] { return currentData2DItem()->axItemX()->max(); }, [this](double newValue) { for (auto* item : allData2DItems()) @@ -112,7 +112,7 @@ void Scale2DEditor::createPanelElements() yFormLayout->setContentsMargins(0, 0, 0, 0); yFormLayout->setSpacing(5); - yFormLayout->addRow("Min:", GUI::Util::createDoubleSpinbox( + yFormLayout->addRow("Min:", GUI::Util::createDoubleSpinBox( [this] { return currentData2DItem()->axItemY()->min(); }, [this](double newValue) { for (auto* item : allData2DItems()) @@ -121,7 +121,7 @@ void Scale2DEditor::createPanelElements() }, &m_updaters)); - yFormLayout->addRow("Max:", GUI::Util::createDoubleSpinbox( + yFormLayout->addRow("Max:", GUI::Util::createDoubleSpinBox( [this] { return currentData2DItem()->axItemY()->max(); }, [this](double newValue) { for (auto* item : allData2DItems()) @@ -138,7 +138,7 @@ void Scale2DEditor::createPanelElements() zFormLayout->setContentsMargins(0, 0, 0, 0); zFormLayout->setSpacing(5); - auto* logRangeSpinbox = GUI::Util::createDoubleSpinbox( + auto* logRangeSpinBox = GUI::Util::createDoubleSpinBox( [this] { return currentData2DItem()->zAxisItem()->logRangeOrders(); }, [this](double newValue) { for (auto* item : mainData2DItems()) { @@ -149,7 +149,7 @@ void Scale2DEditor::createPanelElements() }, &m_updaters, "Dynamic range to display values", RealLimits::positive()); - zFormLayout->addRow("Min:", GUI::Util::createDoubleSpinbox( + zFormLayout->addRow("Min:", GUI::Util::createDoubleSpinBox( [this] { return currentData2DItem()->zAxisItem()->min(); }, [this](double newValue) { for (auto* item : allData2DItems()) { @@ -161,7 +161,7 @@ void Scale2DEditor::createPanelElements() }, &m_updaters)); - zFormLayout->addRow("Max:", GUI::Util::createDoubleSpinbox( + zFormLayout->addRow("Max:", GUI::Util::createDoubleSpinBox( [this] { return currentData2DItem()->zAxisItem()->max(); }, [this](double newValue) { for (auto* item : mainData2DItems()) { @@ -175,15 +175,15 @@ void Scale2DEditor::createPanelElements() zFormLayout->addRow(GUI::Util::createCheckBox( "log10", [this] { return currentData2DItem()->zAxisItem()->isLogScale(); }, - [this, logRangeSpinbox](bool b) { - logRangeSpinbox->setEnabled(b); + [this, logRangeSpinBox](bool b) { + logRangeSpinBox->setEnabled(b); for (auto* item : allData2DItems()) item->zAxisItem()->setLogScale(b); gProjectDocument.value()->setModified(); }, &m_updaters)); - zFormLayout->addRow("Log range:", logRangeSpinbox); + zFormLayout->addRow("Log range:", logRangeSpinBox); zFormLayout->addRow(GUI::Util::createCheckBox( "Visible", [this] { return currentData2DItem()->zAxisItem()->isVisible(); },