diff --git a/Doc/graph/mask-classes.gv b/Doc/graph/mask-classes.gv index c3ed6cc7f67b3055c2b0e2e3c324aa1d076c910e..c167ef17e61ff890d7011679df1c5c986936e047 100644 --- a/Doc/graph/mask-classes.gv +++ b/Doc/graph/mask-classes.gv @@ -33,11 +33,11 @@ EllipseItem->DoubleProperty; MasksPanel[label="MasksPanel\n< QWidget" style=filled fillcolor=orchid]; MasksPanel->MasksQModel; MasksPanel->MaskItem; -MasksPanel->DoubleSpinBox[style=dashed color=blue] MasksPanel +MasksPanel->DSpinBox[style=dashed color=blue] MasksPanel ->EllipseItem[style=dotted color=magenta]; -DoubleSpinBox[label="DoubleSpinBox\n< QAbstractSpinBox\n< QWidget" style=filled fillcolor=orchid]; -DoubleSpinBox->DoubleProperty; +DSpinBox[label="DSpinBox\n< QAbstractSpinBox\n< QWidget" style=filled fillcolor=orchid]; +DSpinBox->DoubleProperty; DoubleProperty[label="DoubleProperty\n< QObject" style=filled fillcolor=beige]; diff --git a/GUI/Model/Util/UtilXML.h b/GUI/Model/Util/UtilXML.h index 1005d96f2a224dadb5e41c4d4b2948749a8e9027..5d5278293aaaeb7faadd2f4a55266bf81967961d 100644 --- a/GUI/Model/Util/UtilXML.h +++ b/GUI/Model/Util/UtilXML.h @@ -15,10 +15,10 @@ #ifndef BORNAGAIN_GUI_MODEL_UTIL_UTILXML_H #define BORNAGAIN_GUI_MODEL_UTIL_UTILXML_H +#include <QColor> #include <QXmlStreamReader> // used in every including file, also provides QXmlStreamWriter #include <heinz/Complex.h> #include <heinz/Vectors3D.h> -#include <QColor> namespace XML { diff --git a/GUI/View/Device/AxisForm.cpp b/GUI/View/Device/AxisForm.cpp index d6149ac4ec6970b6d67de6acf7901e55c0df4839..c02571891aefc501f7dd781bc09af06c5bb34b85 100644 --- a/GUI/View/Device/AxisForm.cpp +++ b/GUI/View/Device/AxisForm.cpp @@ -41,7 +41,7 @@ AxisForm::AxisForm(QWidget* parent, const QString& groupTitle, AxisProperty* axi 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) { + connect(m_min_spin_box, &DSpinBox::valueChanged, [this](double v) { if (m_axis_property->min().dVal() != v) { m_axis_property->setMin(v); emit dataChanged(); @@ -52,7 +52,7 @@ AxisForm::AxisForm(QWidget* parent, const QString& groupTitle, AxisProperty* axi } }); - connect(m_max_spin_box, &DoubleSpinBox::valueChanged, [this](double v) { + connect(m_max_spin_box, &DSpinBox::valueChanged, [this](double v) { if (m_axis_property->max().dVal() != v) { m_axis_property->setMax(v); emit dataChanged(); diff --git a/GUI/View/Device/AxisForm.h b/GUI/View/Device/AxisForm.h index bfc5d8862617daf970b6f41393b4db0e510fcc79..c8b864c0987388c1d6ca5b93ee0b9dcf16453514 100644 --- a/GUI/View/Device/AxisForm.h +++ b/GUI/View/Device/AxisForm.h @@ -19,7 +19,7 @@ #include <QSpinBox> class AxisProperty; -class DoubleSpinBox; +class DSpinBox; //! Use this to edit an AxisProperty. //! @@ -38,8 +38,8 @@ signals: private: QSpinBox* m_nbins_spin_box; AxisProperty* m_axis_property; - DoubleSpinBox* m_min_spin_box; - DoubleSpinBox* m_max_spin_box; + DSpinBox* m_min_spin_box; + DSpinBox* m_max_spin_box; }; diff --git a/GUI/View/Device/BackgroundForm.cpp b/GUI/View/Device/BackgroundForm.cpp index 75fce7ef1945041f74b5579a32af0dcd74f1ad85..779729ffb131f63002be33450ff130240de44aa8 100644 --- a/GUI/View/Device/BackgroundForm.cpp +++ b/GUI/View/Device/BackgroundForm.cpp @@ -49,7 +49,7 @@ void BackgroundForm::createBackgroundWidgets() if (auto* p = dynamic_cast<ConstantBackgroundItem*>(backgroundItem)) { auto* sb = GUI::Util::addDoubleSpinBoxRow(m_form_layout, p->backgroundValue()); sb->setMinimumWidth(150); - connect(sb, &DoubleSpinBox::valueChanged, [this, p](double v) { + connect(sb, &DSpinBox::valueChanged, [this, p](double v) { p->setBackgroundValue(v); emit dataChanged(); }); diff --git a/GUI/View/Device/DetectorEditor.cpp b/GUI/View/Device/DetectorEditor.cpp index e1295d3e67efb76f88dd0d49b23b068d62071c0a..e7cf02a543e337d08962e4a98a4a5decbae4698e 100644 --- a/GUI/View/Device/DetectorEditor.cpp +++ b/GUI/View/Device/DetectorEditor.cpp @@ -61,12 +61,12 @@ DetectorEditor::DetectorEditor(QWidget* parent, Scatter2DInstrumentItem* instrIt auto* sigmaXSpinBox = GUI::Util::addDoubleSpinBoxRow(layout, p->sigmaX()); auto* sigmaYSpinBox = GUI::Util::addDoubleSpinBoxRow(layout, p->sigmaY()); - connect(sigmaXSpinBox, &DoubleSpinBox::valueChanged, [parent, p](double newValue) { + connect(sigmaXSpinBox, &DSpinBox::valueChanged, [parent, p](double newValue) { p->setSigmaX(newValue); emit parent->dataChanged(); }); - connect(sigmaYSpinBox, &DoubleSpinBox::valueChanged, [parent, p](double newValue) { + connect(sigmaYSpinBox, &DSpinBox::valueChanged, [parent, p](double newValue) { p->setSigmaY(newValue); emit parent->dataChanged(); }); diff --git a/GUI/View/Device/DistributionSelector.cpp b/GUI/View/Device/DistributionSelector.cpp index 5f6b1f40921d95d81c0531c03fb655a3afbb6359..3ac8b260ceb66db95d753f1e69125a1be9be918d 100644 --- a/GUI/View/Device/DistributionSelector.cpp +++ b/GUI/View/Device/DistributionSelector.cpp @@ -58,13 +58,13 @@ void DistributionSelector::createDistributionWidgets() } else if (auto* it = dynamic_cast<DistributionGateItem*>(m_item->distributionItem())) { auto* minSpinBox = createSpinBox(it->minimum()); auto* maxSpinBox = createSpinBox(it->maximum()); - connect(minSpinBox, &DoubleSpinBox::valueChanged, [it, maxSpinBox](double d) { + connect(minSpinBox, &DSpinBox::valueChanged, [it, maxSpinBox](double d) { if (d > it->maximum().dVal()) { it->setMaximum(d); maxSpinBox->updateValue(); } }); - connect(maxSpinBox, &DoubleSpinBox::valueChanged, [it, minSpinBox](double d) { + connect(maxSpinBox, &DSpinBox::valueChanged, [it, minSpinBox](double d) { if (d < it->minimum().dVal()) { it->setMinimum(d); minSpinBox->updateValue(); @@ -109,10 +109,10 @@ void DistributionSelector::createNumSamplesSpinBox(DistributionItem* dist) RealLimits::lowerLimited(1))); } -DoubleSpinBox* DistributionSelector::createSpinBox(DoubleProperty& d) +DSpinBox* DistributionSelector::createSpinBox(DoubleProperty& d) { auto* sb = GUI::Util::addDoubleSpinBoxRow(m_form_layout, d); - connect(sb, &DoubleSpinBox::valueChanged, [this, &d](double v) { + connect(sb, &DSpinBox::valueChanged, [this, &d](double v) { d.setDVal(v); emit distributionChanged(); }); @@ -124,7 +124,7 @@ void DistributionSelector::createMeanSpinBox(DoubleProperty& d) if (m_mean_config) { if (m_mean_config->scientific) { auto* sb = GUI::Util::addDoubleSpinBoxRow(m_form_layout, d); - connect(sb, &DoubleSpinBox::valueChanged, [this, &d](double v) { + connect(sb, &DSpinBox::valueChanged, [this, &d](double v) { d.setDVal(v); emit distributionChanged(); }); diff --git a/GUI/View/Device/DistributionSelector.h b/GUI/View/Device/DistributionSelector.h index 198abbeb2258152dfed8c193351315f3351d4811..e4aa5fc78eb2fba440b45a6a6e1098ed922f28f9 100644 --- a/GUI/View/Device/DistributionSelector.h +++ b/GUI/View/Device/DistributionSelector.h @@ -21,9 +21,9 @@ #include <optional> class BeamDistributionItem; +class DSpinBox; class DistributionItem; class DoubleProperty; -class DoubleSpinBox; //! configuration to control how the user can enter a mean value struct MeanConfig { @@ -58,7 +58,7 @@ signals: private: void createDistributionWidgets(); void createNumSamplesSpinBox(DistributionItem* dist); - DoubleSpinBox* createSpinBox(DoubleProperty& d); + DSpinBox* createSpinBox(DoubleProperty& d); void createMeanSpinBox(DoubleProperty& d); BeamDistributionItem* m_item; diff --git a/GUI/View/Device/FootprintForm.cpp b/GUI/View/Device/FootprintForm.cpp index e518c2223b1c3c1aeb204220161d4cc96b8336f4..64cb5cbe6864d12d1a87a263c2ccba5165d90b40 100644 --- a/GUI/View/Device/FootprintForm.cpp +++ b/GUI/View/Device/FootprintForm.cpp @@ -50,14 +50,14 @@ void FootprintForm::updateFootprintWidgets() if (auto* sqr = dynamic_cast<FootprintSquareItem*>(footprintItem)) { auto* sb = GUI::Util::addDoubleSpinBoxRow(m_form_layout, sqr->squareFootprintValue()); sb->setMinimumWidth(sb_width); - connect(sb, &DoubleSpinBox::valueChanged, [this, sqr](double v) { + connect(sb, &DSpinBox::valueChanged, [this, sqr](double v) { sqr->setSquareFootprintValue(v); emit dataChanged(); }); } else if (auto* gs = dynamic_cast<FootprintGaussianItem*>(footprintItem)) { auto* sb = GUI::Util::addDoubleSpinBoxRow(m_form_layout, gs->gaussianFootprintValue()); sb->setMinimumWidth(sb_width); - connect(sb, &DoubleSpinBox::valueChanged, [this, gs](double v) { + connect(sb, &DSpinBox::valueChanged, [this, gs](double v) { gs->setGaussianFootprintValue(v); emit dataChanged(); }); diff --git a/GUI/View/Device/GISASBeamEditor.cpp b/GUI/View/Device/GISASBeamEditor.cpp index 505e815a16f302237787ab00d63695ead69b4744..64640e643b73a698e6d8da1e5baca89bd0381c6b 100644 --- a/GUI/View/Device/GISASBeamEditor.cpp +++ b/GUI/View/Device/GISASBeamEditor.cpp @@ -34,7 +34,7 @@ GISASBeamEditor::GISASBeamEditor(QWidget* parent, BeamItem* item) layout->addLayout(form); form->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint); - auto* intensity_spinbox = new DoubleSpinBox(&item->intensity()); + auto* intensity_spinbox = new DSpinBox(&item->intensity()); form->addRow("Intensity:", intensity_spinbox); intensity_spinbox->setToolTip("Beam intensity in neutrons/photons per second."); diff --git a/GUI/View/Device/PolarizationAnalysisEditor.cpp b/GUI/View/Device/PolarizationAnalysisEditor.cpp index 0e97d6e6d30c66ce72a0845fd91f01a5ce7d77da..8ecd98e7f2131ea19a663dd3885755e3ee28b3df 100644 --- a/GUI/View/Device/PolarizationAnalysisEditor.cpp +++ b/GUI/View/Device/PolarizationAnalysisEditor.cpp @@ -72,10 +72,10 @@ PolarizationAnalysisEditor::PolarizationAnalysisEditor(QWidget* parent, Instrume } } -DoubleSpinBox* PolarizationAnalysisEditor::createSpinBox(DoubleProperty& d) +DSpinBox* PolarizationAnalysisEditor::createSpinBox(DoubleProperty& d) { - auto* sb = new DoubleSpinBox(&d); - connect(sb, &DoubleSpinBox::valueChanged, [this, &d](double v) { + auto* sb = new DSpinBox(&d); + connect(sb, &DSpinBox::valueChanged, [this, &d](double v) { if (d.dVal() != v) { d.setDVal(v); emit dataChanged(); diff --git a/GUI/View/Device/PolarizationAnalysisEditor.h b/GUI/View/Device/PolarizationAnalysisEditor.h index 8d1023b49c12035d88179c243922fc85778ab773..3456af9537fa69808b1994fcfa1a0e7a9d7da208 100644 --- a/GUI/View/Device/PolarizationAnalysisEditor.h +++ b/GUI/View/Device/PolarizationAnalysisEditor.h @@ -18,8 +18,8 @@ #include "GUI/View/Widget/GroupBoxes.h" #include <QFormLayout> +class DSpinBox; class DoubleProperty; -class DoubleSpinBox; class InstrumentItem; class VectorProperty; @@ -35,7 +35,7 @@ signals: void dataChanged(); private: - DoubleSpinBox* createSpinBox(DoubleProperty& d); + DSpinBox* createSpinBox(DoubleProperty& d); void addBlochRow(QFormLayout* parentLayout, VectorProperty& v); InstrumentItem* m_instrument; diff --git a/GUI/View/Device/ScanEditor.cpp b/GUI/View/Device/ScanEditor.cpp index 65a2cdc9813a266926bf16447bc1782cf2ff7df9..7a59c6562c683f8a8709864e0d6411d08bed8658 100644 --- a/GUI/View/Device/ScanEditor.cpp +++ b/GUI/View/Device/ScanEditor.cpp @@ -39,7 +39,7 @@ ScanEditor::ScanEditor(QWidget* parent, InstrumentItem* instr_item, ScanItem* it auto* form = new QFormLayout; layout->addLayout(form); form->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint); - auto* intensity_spinbox = new DoubleSpinBox(&item->intensity()); + auto* intensity_spinbox = new DSpinBox(&item->intensity()); form->addRow("Intensity:", intensity_spinbox); intensity_spinbox->setToolTip("Correction factor for normalized intensity"); diff --git a/GUI/View/Device/SpanForm.cpp b/GUI/View/Device/SpanForm.cpp index ec4de043b6194807bad6f1dbb9fe93aad43f6dc4..b3b33359869b2249235ed56c7338388617b91817 100644 --- a/GUI/View/Device/SpanForm.cpp +++ b/GUI/View/Device/SpanForm.cpp @@ -42,7 +42,7 @@ SpanForm::SpanForm(QWidget* parent, const QString& group_title, SpanProperty* sp 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) { + connect(m_width_spin_box, &DSpinBox::valueChanged, [this](double v) { ASSERT(v >= 0); // spin box should have got limits from property if (m_span_property->width().dVal() != v) { m_span_property->setWidth(v); @@ -50,7 +50,7 @@ SpanForm::SpanForm(QWidget* parent, const QString& group_title, SpanProperty* sp } }); - connect(m_center_spin_box, &DoubleSpinBox::valueChanged, [this](double v) { + connect(m_center_spin_box, &DSpinBox::valueChanged, [this](double v) { if (m_span_property->center().dVal() != v) { m_span_property->setCenter(v); emit changedSpanData(); diff --git a/GUI/View/Device/SpanForm.h b/GUI/View/Device/SpanForm.h index 831be5b1e84bb96738c5a3f4d116c3fb19cf9765..24682047670cbec6bdf49a487435d97d0e11ed8e 100644 --- a/GUI/View/Device/SpanForm.h +++ b/GUI/View/Device/SpanForm.h @@ -18,7 +18,7 @@ #include "GUI/View/Widget/GroupBoxes.h" #include <QSpinBox> -class DoubleSpinBox; +class DSpinBox; class SpanProperty; //! Use this to edit an SpanProperty. @@ -38,8 +38,8 @@ signals: private: QSpinBox* m_nbins_spin_box; SpanProperty* m_span_property; - DoubleSpinBox* m_width_spin_box; - DoubleSpinBox* m_center_spin_box; + DSpinBox* m_width_spin_box; + DSpinBox* m_center_spin_box; QVector<std::function<void()>> m_updaters; }; diff --git a/GUI/View/Material/MaterialEditorDialog.cpp b/GUI/View/Material/MaterialEditorDialog.cpp index 9c9e1ebe514f435a3449799a3b78af372017cad4..f95932347bd810415b8682561854fa786363ccaa 100644 --- a/GUI/View/Material/MaterialEditorDialog.cpp +++ b/GUI/View/Material/MaterialEditorDialog.cpp @@ -79,13 +79,13 @@ private: QWidget* m_editor; QGroupBox* m_sld_group; QGroupBox* m_refr_group; - DoubleSpinBox* m_delta_spinbox; - DoubleSpinBox* m_beta_spinbox; - DoubleSpinBox* m_re_sld_spinbox; - DoubleSpinBox* m_im_sld_spinbox; - DoubleSpinBox* m_Bx_spinbox; - DoubleSpinBox* m_By_spinbox; - DoubleSpinBox* m_Bz_spinbox; + DSpinBox* m_delta_spinbox; + DSpinBox* m_beta_spinbox; + DSpinBox* m_re_sld_spinbox; + DSpinBox* m_im_sld_spinbox; + DSpinBox* m_Bx_spinbox; + DSpinBox* m_By_spinbox; + DSpinBox* m_Bz_spinbox; QLineEdit* m_name_edit; QLineEdit* m_color_info; }; @@ -158,8 +158,8 @@ MaterialEditorDialog::MaterialEditorDialog(SampleItem* sample, const QString& id auto* refr_form = new QFormLayout; m_refr_group->setLayout(refr_form); - m_delta_spinbox = new DoubleSpinBox(nullptr); - m_beta_spinbox = new DoubleSpinBox(nullptr); + m_delta_spinbox = new DSpinBox(nullptr); + m_beta_spinbox = new DSpinBox(nullptr); refr_form->addRow("Delta:", m_delta_spinbox); refr_form->addRow("Beta:", m_beta_spinbox); @@ -168,8 +168,8 @@ MaterialEditorDialog::MaterialEditorDialog(SampleItem* sample, const QString& id auto* sld_form = new QFormLayout; m_sld_group->setLayout(sld_form); - m_re_sld_spinbox = new DoubleSpinBox(nullptr); - m_im_sld_spinbox = new DoubleSpinBox(nullptr); + m_re_sld_spinbox = new DSpinBox(nullptr); + m_im_sld_spinbox = new DSpinBox(nullptr); sld_form->addRow("Real:", m_re_sld_spinbox); sld_form->addRow("Imaginary:", m_im_sld_spinbox); @@ -179,9 +179,9 @@ MaterialEditorDialog::MaterialEditorDialog(SampleItem* sample, const QString& id ed_vlayout->addWidget(magn_group); auto* magn_form = new QFormLayout(magn_group); - m_Bx_spinbox = new DoubleSpinBox(nullptr); - m_By_spinbox = new DoubleSpinBox(nullptr); - m_Bz_spinbox = new DoubleSpinBox(nullptr); + m_Bx_spinbox = new DSpinBox(nullptr); + m_By_spinbox = new DSpinBox(nullptr); + m_Bz_spinbox = new DSpinBox(nullptr); magn_form->addRow("X:", m_Bx_spinbox); magn_form->addRow("Y:", m_By_spinbox); @@ -324,7 +324,7 @@ void MaterialEditorDialog::onSelectMaterial() m_sld_group->hide(); for (auto* lineEdit : m_editor->findChildren<QLineEdit*>()) lineEdit->clear(); - for (auto* spinBox : m_editor->findChildren<DoubleSpinBox*>()) + for (auto* spinBox : m_editor->findChildren<DSpinBox*>()) spinBox->replaceProperty(nullptr); return; } diff --git a/GUI/View/Numeric/DSpinBox.cpp b/GUI/View/Numeric/DSpinBox.cpp index 4cf424b8b2982d156fc8958784a7e54d6b6dcfbd..64948d998db78e84aba83eba1f091988a41f1545 100644 --- a/GUI/View/Numeric/DSpinBox.cpp +++ b/GUI/View/Numeric/DSpinBox.cpp @@ -3,7 +3,7 @@ // BornAgain: simulate and fit reflection and scattering // //! @file GUI/View/Numeric/DSpinBox.cpp -//! @brief Implements class DoubleSpinBox. +//! @brief Implements class DSpinBox. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,11 +12,11 @@ // // ************************************************************************************************ +#include "GUI/View/Numeric/DSpinBox.h" #include "Base/Math/Numeric.h" #include "Base/Util/Assert.h" #include "Base/Util/StringUtil.h" #include "GUI/Model/Descriptor/DoubleProperty.h" -#include "GUI/View/Numeric/DSpinBox.h" #include <QLineEdit> #include <QRegularExpression> #include <QWheelEvent> @@ -43,7 +43,7 @@ QString toString(double val, int decimal_points = 6) } // namespace -DoubleSpinBox::DoubleSpinBox(DoubleProperty* d) +DSpinBox::DSpinBox(DoubleProperty* d) : m_step(::step0) { replaceProperty(d); @@ -57,7 +57,7 @@ DoubleSpinBox::DoubleSpinBox(DoubleProperty* d) // setSingleStep(m_property->step()); } -void DoubleSpinBox::replaceProperty(DoubleProperty* d) +void DSpinBox::replaceProperty(DoubleProperty* d) { if (m_property) disconnect(m_property); @@ -67,14 +67,14 @@ void DoubleSpinBox::replaceProperty(DoubleProperty* d) setToolTip(d->tooltip()); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); lineEdit()->setText(toString(m_property->dVal())); - connect(d, &DoubleProperty::setAndNotifyCalled, this, &DoubleSpinBox::updateValue); + connect(d, &DoubleProperty::setAndNotifyCalled, this, &DSpinBox::updateValue); // [this] { updateValue(); }); } setReadOnly(!m_property); updateValue(); } -void DoubleSpinBox::updateValue() +void DSpinBox::updateValue() { if (m_property) lineEdit()->setText(toString(m_property->dVal())); @@ -82,12 +82,12 @@ void DoubleSpinBox::updateValue() lineEdit()->setText(""); } -QAbstractSpinBox::StepEnabled DoubleSpinBox::stepEnabled() const +QAbstractSpinBox::StepEnabled DSpinBox::stepEnabled() const { return StepUpEnabled | StepDownEnabled; } -double DoubleSpinBox::fromDisplay() const +double DSpinBox::fromDisplay() const { double result; if (Base::String::to_double(lineEdit()->text().toStdString(), &result)) @@ -96,7 +96,7 @@ double DoubleSpinBox::fromDisplay() const return m_property->dVal(); } -void DoubleSpinBox::setValue(double val) +void DSpinBox::setValue(double val) { ASSERT(m_property); const double oldval = m_property->dVal(); @@ -107,7 +107,7 @@ void DoubleSpinBox::setValue(double val) emit valueChanged(m_property->dVal()); } -void DoubleSpinBox::wheelEvent(QWheelEvent* event) +void DSpinBox::wheelEvent(QWheelEvent* event) { if (hasFocus()) QAbstractSpinBox::wheelEvent(event); @@ -115,7 +115,7 @@ void DoubleSpinBox::wheelEvent(QWheelEvent* event) event->ignore(); } -void DoubleSpinBox::stepBy(int steps) +void DSpinBox::stepBy(int steps) { ASSERT(m_property); diff --git a/GUI/View/Numeric/DSpinBox.h b/GUI/View/Numeric/DSpinBox.h index 8fbb6ddc79f59acf501cb1c2fd499dbfc4586c2f..4817d8402914201ed8df79d4d7ec79f8a31ef5d1 100644 --- a/GUI/View/Numeric/DSpinBox.h +++ b/GUI/View/Numeric/DSpinBox.h @@ -3,7 +3,7 @@ // BornAgain: simulate and fit reflection and scattering // //! @file GUI/View/Numeric/DSpinBox.h -//! @brief Defines class DoubleSpinBox. +//! @brief Defines class DSpinBox. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -20,16 +20,16 @@ class DoubleProperty; //! SpinBox for DoubleProperties, supporting units. -class DoubleSpinBox : public QAbstractSpinBox { +class DSpinBox : public QAbstractSpinBox { Q_OBJECT public: - //! Create a DoubleSpinBox with the information found in a DoubleProperty. + //! Create a DSpinBox with the information found in a DoubleProperty. //! //! The spin box will be fully initialized (tooltip, limits, unit, current value, size //! policy). Furthermore, the spin box will prohibit accidental changes by the mouse wheel. //! 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. - explicit DoubleSpinBox(DoubleProperty* d); + explicit DSpinBox(DoubleProperty* d); void replaceProperty(DoubleProperty* d); diff --git a/GUI/View/Numeric/NumWidgetUtil.cpp b/GUI/View/Numeric/NumWidgetUtil.cpp index 3a7fb9f11e43c5412b317b58d8a4566e40f35cce..bc8e418bfe6a6d36236bed9c531ab91b00adeda7 100644 --- a/GUI/View/Numeric/NumWidgetUtil.cpp +++ b/GUI/View/Numeric/NumWidgetUtil.cpp @@ -19,9 +19,9 @@ #include <QLabel> #include <QLineEdit> -DoubleSpinBox* GUI::Util::addDoubleSpinBoxRow(QFormLayout* parentLayout, DoubleProperty& d) +DSpinBox* GUI::Util::addDoubleSpinBoxRow(QFormLayout* parentLayout, DoubleProperty& d) { - auto* result = new DoubleSpinBox(&d); + auto* result = new DSpinBox(&d); parentLayout->addRow(d.label() + ":", result); return result; } diff --git a/GUI/View/Numeric/NumWidgetUtil.h b/GUI/View/Numeric/NumWidgetUtil.h index 972f3b2e6f7159522afd64758923342747275aa8..87c4130318b62c5e929f16261a5976a661204201 100644 --- a/GUI/View/Numeric/NumWidgetUtil.h +++ b/GUI/View/Numeric/NumWidgetUtil.h @@ -21,8 +21,8 @@ #include <QSpinBox> #include <QString> +class DSpinBox; class DoubleProperty; -class DoubleSpinBox; class RealLimits; 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 //! will *not* be notified to the property. -DoubleSpinBox* addDoubleSpinBoxRow(QFormLayout* parentLayout, DoubleProperty& d); +DSpinBox* addDoubleSpinBoxRow(QFormLayout* parentLayout, DoubleProperty& d); //! Creates an updatable checkbox QCheckBox* createCheckBox(const QString& title, std::function<bool()> getter, diff --git a/GUI/View/Sample/HeinzFormLayout.cpp b/GUI/View/Sample/HeinzFormLayout.cpp index 48913ee5eb664029eae1fc09f83e5c5d7dcdf61a..aca8db8458051cb5fa21fa3bed96d623fd92a2c6 100644 --- a/GUI/View/Sample/HeinzFormLayout.cpp +++ b/GUI/View/Sample/HeinzFormLayout.cpp @@ -127,8 +127,8 @@ void HeinzFormLayout::insertValue(int row, DoubleProperty& d) void HeinzFormLayout::insertValue(int row, DoubleProperty& d, std::function<void(double)> onValueChange) { - auto* editor = new DoubleSpinBox(&d); - QObject::connect(editor, &DoubleSpinBox::valueChanged, onValueChange); + auto* editor = new DSpinBox(&d); + QObject::connect(editor, &DSpinBox::valueChanged, onValueChange); QString labelText = d.label(); if (!labelText.endsWith(":")) diff --git a/GUI/View/Sample/HeinzFormLayout.h b/GUI/View/Sample/HeinzFormLayout.h index eca533e04ef7e32fb18cc089d376163c165b0e80..c84700a2b0aeaef8eccd3ccb7db9b5a3eaa6cdcc 100644 --- a/GUI/View/Sample/HeinzFormLayout.h +++ b/GUI/View/Sample/HeinzFormLayout.h @@ -34,7 +34,7 @@ public: //! //! If the parent has no layout yet, a QFormLayout is installed. If the parentWidget already has //! a QFormLayout, this will be used for the calls later on. - //! The given SampleEditorController is used to create connections e.g. when a DoubleSpinBox + //! The given SampleEditorController is used to create connections e.g. when a DSpinBox //! value has been changed. HeinzFormLayout(SampleEditorController* ec); @@ -61,11 +61,11 @@ public: addBoldRow(d.label(), new PolyForm(QFormLayout::parentWidget(), d, m_ec)); } - //! Adds a row with a bold printed label and a DoubleSpinBox. + //! Adds a row with a bold printed label and a DSpinBox. //! - //! The DoubleSpinBox is initialized with the contents found in the DoubleProperty (e.g. limits, - //! decimals, unit). The DoubleSpinBox is set as the "buddy" of the label. This is necessary to - //! realize the "label shows unit of value" feature. Changes of the DoubleSpinBox are signaled + //! The DSpinBox is initialized with the contents found in the DoubleProperty (e.g. limits, + //! decimals, unit). The DSpinBox is set as the "buddy" of the label. This is necessary to + //! realize the "label shows unit of value" feature. Changes of the DSpinBox are signaled //! to the SampleEditorController which has been overhanded in the constructor of this. //! It is connected to SampleEditorController::setDouble(). If a different method //! should be called (e.g. for a special undo functionality), this method is not sufficient. It @@ -73,19 +73,19 @@ public: //! Returns the newly added row. void addValue(DoubleProperty& d); - //! Adds a row with a bold printed label and a DoubleSpinBox. + //! Adds a row with a bold printed label and a DSpinBox. //! //! Same as above, but the called slot in case of a value change has to be overhanded. //! Use this only if the standard (calling SampleEditorController::setDouble()) is not //! sufficient. void addValue(DoubleProperty& d, std::function<void(double)> onValueChange); - //! Inserts a row with a bold printed label and a DoubleSpinBox. + //! Inserts a row with a bold printed label and a DSpinBox. //! //! Same functionality as addValue(), please read there. void insertValue(int row, DoubleProperty& d); - //! Inserts a row with a bold printed label and a DoubleSpinBox. + //! Inserts a row with a bold printed label and a DSpinBox. //! //! Same functionality as addValue(), please read there. void insertValue(int row, DoubleProperty& d, std::function<void(double)> onValueChange); @@ -93,7 +93,7 @@ public: //! Adds a row with a bold printed label and a set of DoubleProperties. //! //! The label describes the set of the DoubleProperties and is located in the first column of - //! the layout. The DoubleSpinBoxes for each DoubleProperty are created as children of a newly + //! the layout. The DSpinBoxes for each DoubleProperty are created as children of a newly //! created widget, which is positioned in the second column of the layout. If the number of //! values is greater than 1, the related labels are shown above them, to limit the necessary //! space to the right. For the creation, signaling, unit handling etc. of one DoubleProperty diff --git a/GUI/View/Sample/LayerEditorUtil.cpp b/GUI/View/Sample/LayerEditorUtil.cpp index 7881ce00d5752f41bd7668fab6f72d0fda2e21be..079d9e2e19054296b86bc6ddaeee39c71667ffa0 100644 --- a/GUI/View/Sample/LayerEditorUtil.cpp +++ b/GUI/View/Sample/LayerEditorUtil.cpp @@ -46,8 +46,8 @@ void GUI::Util::Layer::addMultiPropertyToGrid( { int col = firstCol; for (auto* d : valueProperties) { - auto* editor = new DoubleSpinBox(&*d); - QObject::connect(editor, &DoubleSpinBox::valueChanged, + auto* editor = new DSpinBox(&*d); + QObject::connect(editor, &DSpinBox::valueChanged, [setNewValue, d](double newValue) { setNewValue(newValue, *d); }); QString labeltext = d->label(); diff --git a/GUI/View/Sample/LayerEditorUtil.h b/GUI/View/Sample/LayerEditorUtil.h index 06668f6ec608e8ad2319e47d467ae93533b41061..bb1b0e3484fea9292ef21cb275b84d29ef44048a 100644 --- a/GUI/View/Sample/LayerEditorUtil.h +++ b/GUI/View/Sample/LayerEditorUtil.h @@ -23,7 +23,7 @@ #include <QPushButton> #include <functional> -class DoubleSpinBox; +class DSpinBox; class FormFactorItem; class ItemWithParticles; class Profile1DItem; @@ -36,13 +36,13 @@ class VectorProperty; //! Utility functions to support layer oriented sample editor namespace GUI::Util::Layer { -//! Create DoubleSpinBoxes for the DoubleProperties and connect them to +//! Create DSpinBoxes for the DoubleProperties and connect them to //! SampleEditorController::setDouble() void addMultiPropertyToGrid(QGridLayout* m_grid_layout, int firstCol, const DoubleProperties& valueProperties, SampleEditorController* ec, bool vertically, bool addSpacer); -//! Create DoubleSpinBoxes for the DoubleProperties and connect them to the given setNewValue() +//! Create DSpinBoxes for the DoubleProperties and connect them to the given setNewValue() void addMultiPropertyToGrid(QGridLayout* m_grid_layout, int firstCol, const DoubleProperties& valueProperties, std::function<void(double, DoubleProperty&)> setNewValue, diff --git a/GUI/View/Sample/MaterialInplaceForm.cpp b/GUI/View/Sample/MaterialInplaceForm.cpp index d5a741e86964ae06d7e03c24acb481cf403d0d75..08c2b3ecef5188f9732be7178d1530eb61a4916e 100644 --- a/GUI/View/Sample/MaterialInplaceForm.cpp +++ b/GUI/View/Sample/MaterialInplaceForm.cpp @@ -42,7 +42,7 @@ MaterialInplaceForm::MaterialInplaceForm(ItemWithMaterial* item, SampleEditorCon } void MaterialInplaceForm::updateValues() { - for (auto* editor : findChildren<DoubleSpinBox*>()) { + for (auto* editor : findChildren<DSpinBox*>()) { QSignalBlocker b(editor); editor->updateValue(); } @@ -86,11 +86,11 @@ void MaterialInplaceForm::createWidgets() int col = 0; for (DoubleProperty* d : values) { - auto* editor = new DoubleSpinBox(&*d); + auto* editor = new DSpinBox(&*d); auto* label = new QLabel(d->label(), this); label->setBuddy(editor); - QObject::connect(editor, &DoubleSpinBox::valueChanged, [this, d](double newValue) { + QObject::connect(editor, &DSpinBox::valueChanged, [this, d](double newValue) { m_ec->setMaterialValue(m_item, newValue, *d); }); diff --git a/GUI/View/Sample/ParticleLayoutForm.cpp b/GUI/View/Sample/ParticleLayoutForm.cpp index 414daab3a5b4049fd7ceb5a3c4f3476deee940d7..da8172ab465dff768ce78c0fc1d1e15d4bd5814f 100644 --- a/GUI/View/Sample/ParticleLayoutForm.cpp +++ b/GUI/View/Sample/ParticleLayoutForm.cpp @@ -41,7 +41,7 @@ ParticleLayoutForm::ParticleLayoutForm(LayerForm* form, ParticleLayoutItem* t, m_layout->addValue(m_layout_item->ownDensity()); int rowOfTotalDensity = m_layout->rowCount() - 1; m_total_density_spin_box = - m_layout->widgetAt<DoubleSpinBox*>(rowOfTotalDensity, QFormLayout::FieldRole); + m_layout->widgetAt<DSpinBox*>(rowOfTotalDensity, QFormLayout::FieldRole); ASSERT(m_total_density_spin_box); m_layout->addRow(new InterferenceForm(this, t, ec)); diff --git a/GUI/View/Sample/ParticleLayoutForm.h b/GUI/View/Sample/ParticleLayoutForm.h index 8954a65bbdbf677a9dd19b5b588c3637645e6156..d1ee9e498b142b0683fe9bdde93f8b8bf815ed6d 100644 --- a/GUI/View/Sample/ParticleLayoutForm.h +++ b/GUI/View/Sample/ParticleLayoutForm.h @@ -18,7 +18,7 @@ #include "GUI/View/Widget/GroupBoxes.h" #include <QVector> -class DoubleSpinBox; +class DSpinBox; class HeinzFormLayout; class ItemWithParticles; class LayerForm; @@ -56,7 +56,7 @@ private: QAction* m_duplicate_action; SampleEditorController* m_ec; QVector<QWidget*> m_structure_editing_widgets; - DoubleSpinBox* m_total_density_spin_box; + DSpinBox* m_total_density_spin_box; }; #endif // BORNAGAIN_GUI_VIEW_SAMPLE_PARTICLELAYOUTFORM_H diff --git a/GUI/View/Sample/PolyForm.h b/GUI/View/Sample/PolyForm.h index cbb13ecd115afdce0b3379ebe148ca463d1850d7..04b07d8e1f469a743ab8b8892ae49e6ef047b98d 100644 --- a/GUI/View/Sample/PolyForm.h +++ b/GUI/View/Sample/PolyForm.h @@ -33,7 +33,7 @@ //! The connection from selection combo -> PolyItem is made via //! SampleEditorController::setCurrentIndex(), where a command can be used for undo purposes. //! -//! For each DoubleProperty, a unit-aware DoubleSpinBox is created. The connection from each +//! For each DoubleProperty, a unit-aware DSpinBox is created. The connection from each //! spinbox to the DoubleProperty is made via SampleEditorController::setDouble(), where a command //! can be used for undo purposes. //! diff --git a/GUI/View/Setup/MasksPanel.cpp b/GUI/View/Setup/MasksPanel.cpp index 1275a06b6389bbe414a717cf5cd9a2c31f032985..b1dc48436d2016ff1f85afe9c672a2fa5d6424f2 100644 --- a/GUI/View/Setup/MasksPanel.cpp +++ b/GUI/View/Setup/MasksPanel.cpp @@ -28,15 +28,15 @@ namespace { void addSpinBox(MaskItem* mask, QFormLayout* layout, DoubleProperty& property) { - auto* spinbox = new DoubleSpinBox(&property); + auto* spinbox = new DSpinBox(&property); layout->addRow(property.label() + ":", spinbox); - QObject::connect(spinbox, &DoubleSpinBox::valueChanged, [mask](double) { + QObject::connect(spinbox, &DSpinBox::valueChanged, [mask](double) { gDoc->setModified(); ASSERT(mask); emit mask->maskGeometryChanged(); }); QObject::connect(&property, &DoubleProperty::setAndNotifyCalled, spinbox, - &DoubleSpinBox::updateValue); + &DSpinBox::updateValue); } } // namespace diff --git a/GUI/styles/Base.stylesheet b/GUI/styles/Base.stylesheet index f3b5ac4f7d481deaa54ffaf801f14a7aaffcd953..477122dea96b9e0b911579394d938c94526a578a 100644 --- a/GUI/styles/Base.stylesheet +++ b/GUI/styles/Base.stylesheet @@ -479,7 +479,7 @@ LayerForm QLineEdit, QTextEdit, QSpinBox, -DoubleSpinBox, +DSpinBox, ScientificSpinBox, QComboBox { @@ -496,7 +496,7 @@ QComboBox QLineEdit::focus, QTextEdit::focus, QSpinBox::focus, -DoubleSpinBox::focus, +DSpinBox::focus, ScientificSpinBox::focus { border: 2px solid palette(highlight); @@ -523,7 +523,7 @@ QComboBox::drop-down:pressed /* ------------------------------------------------------------------------------- */ QSpinBox::up-button, -DoubleSpinBox::up-button, +DSpinBox::up-button, ScientificSpinBox::up-button { subcontrol-origin: border; @@ -534,19 +534,19 @@ ScientificSpinBox::up-button image: url(:/images/caret-up.svg); } QSpinBox::up-button:hover, -DoubleSpinBox::up-button:hover, +DSpinBox::up-button:hover, ScientificSpinBox::up-button:hover { background-color: palette(light); } QSpinBox::up-button:pressed, -DoubleSpinBox::up-button:pressed, +DSpinBox::up-button:pressed, ScientificSpinBox::up-button:pressed { background-color: palette(mid); } QSpinBox::down-button, -DoubleSpinBox::down-button, +DSpinBox::down-button, ScientificSpinBox::down-button { subcontrol-origin: border; @@ -557,13 +557,13 @@ ScientificSpinBox::down-button image: url(:/images/caret-down.svg); } QSpinBox::down-button:hover, -DoubleSpinBox::down-button:hover, +DSpinBox::down-button:hover, ScientificSpinBox::down-button:hover { background-color: palette(light); } QSpinBox::down-button:pressed, -DoubleSpinBox::down-button:pressed, +DSpinBox::down-button:pressed, ScientificSpinBox::down-button:pressed { background-color: palette(mid); @@ -574,7 +574,7 @@ QWidget{ color: palette(text); } -QTextEdit, QLineEdit, QSpinBox, ScientificSpinBox, QDoubleSpinBox, DoubleSpinBox, QComboBox, QTabWidget, +QTextEdit, QLineEdit, QSpinBox, ScientificSpinBox, QDoubleSpinBox, DSpinBox, QComboBox, QTabWidget, QDockWidget, QTableView, QTableWidget, QHeaderView, QProgressBar, QSlider, QScrollBar, QToolBar, QPushButton, QScrollArea { background-color: palette(base);