diff --git a/GUI/Model/Descriptor/SelectionProperty.h b/GUI/Model/Descriptor/SelectionProperty.h index ed3193a00ef2efc7a5f635095f09d4808e7fad31..3af069b987bf409bb0fccfd4638553bb6335163f 100644 --- a/GUI/Model/Descriptor/SelectionProperty.h +++ b/GUI/Model/Descriptor/SelectionProperty.h @@ -51,7 +51,7 @@ public: //! The initialization of a SelectionProperty is done using a catalog. //! template <typename Catalog> -class SelectionProperty : public AbstractSelectionProperty{ +class SelectionProperty : public AbstractSelectionProperty { public: using CatalogedType = typename Catalog::CatalogedType; @@ -116,7 +116,7 @@ public: CatalogedType* operator->() const { return m_p.get(); } //! Direct access to the stored pointer - CatalogedType* currentItem() const {return m_p.get();} + CatalogedType* currentItem() const { return m_p.get(); } //! Directly set the new item. void setCurrentItem(CatalogedType* t, bool callInitializer = false) @@ -149,16 +149,18 @@ public: } } - QString label() const {return m_label;} - QString tooltip() const {return m_tooltip;} - QStringList options() const {return m_options;} + QString label() const { return m_label; } + QString tooltip() const { return m_tooltip; } + QStringList options() const { return m_options; } void setCurrentIndex(int newIndex) override { currentIndexSetter(newIndex); } int currentIndex() const override { return m_types.indexOf(Catalog::type(m_p.get())); } private: template <typename... ArgsForCreation> - void initFieldsAndSetter(const QString& label, const QString& tooltip, ArgsForCreation... argsForCreation) { + void initFieldsAndSetter(const QString& label, const QString& tooltip, + ArgsForCreation... argsForCreation) + { m_label = label; m_tooltip = tooltip; m_options.clear(); diff --git a/GUI/Model/Device/BeamDistributionItem.h b/GUI/Model/Device/BeamDistributionItem.h index 9e8831bb0d3ae22544e9044a230434812d30b8ad..f1247995ccadf904ffea9ca4625ee11b2e1d1f3c 100644 --- a/GUI/Model/Device/BeamDistributionItem.h +++ b/GUI/Model/Device/BeamDistributionItem.h @@ -40,7 +40,7 @@ public: template <typename T> T* setDistributionType(); DistributionItem* distributionItem() const { return m_distribution.currentItem(); } - SelectionProperty<DistributionItemCatalog>& distribution() { return m_distribution; } + SelectionProperty<DistributionItemCatalog>& distribution() { return m_distribution; } protected: virtual std::unique_ptr<IDistribution1D> createDistribution1D() const; diff --git a/GUI/Model/Device/DetectorItems.h b/GUI/Model/Device/DetectorItems.h index 38dfbb19705a62de72e4a42480cb766c47c2ccca..928fe7c2b42b5e616c12d53ff98a35c85becd750 100644 --- a/GUI/Model/Device/DetectorItems.h +++ b/GUI/Model/Device/DetectorItems.h @@ -49,7 +49,10 @@ public: void importMasks(const MaskContainerItem* maskContainer); MaskItems& maskItems(); - SelectionProperty<ResolutionFunctionItemCatalog>& resolutionFunction() { return m_resolutionFunction; } + SelectionProperty<ResolutionFunctionItemCatalog>& resolutionFunction() + { + return m_resolutionFunction; + } template <typename T> T* setResolutionFunctionType(); diff --git a/GUI/Model/Device/InstrumentItems.h b/GUI/Model/Device/InstrumentItems.h index 21540d7ad04777d77beb54680ac9ec18c99f17d9..ba919d309ac885293e68d32dca91bbed5f3d3c94 100644 --- a/GUI/Model/Device/InstrumentItems.h +++ b/GUI/Model/Device/InstrumentItems.h @@ -49,11 +49,11 @@ public: virtual void serialize(Streamer& s); - QString id() const { return m_id; } - void setId(const QString& id) { m_id = id; } + QString id() const { return m_id; } + void setId(const QString& id) { m_id = id; } - QString instrumentName() const { return m_name; } - void setInstrumentName(const QString& instrumentName) { m_name = instrumentName; } + QString instrumentName() const { return m_name; } + void setInstrumentName(const QString& instrumentName) { m_name = instrumentName; } //! The type as how to show it on the UI. Do not use for type checking or similar! virtual QString instrumentType() const = 0; @@ -64,15 +64,15 @@ public: return dynamic_cast<const T*>(this) != nullptr; } - QString description() const { return m_description; } - void setDescription(const QString& description) { m_description = description; } + QString description() const { return m_description; } + void setDescription(const QString& description) { m_description = description; } virtual BeamItem* beamItem() const; template <typename T> T* setBackgroundType(); - SelectionProperty<BackgroundItemCatalog>& background() { return m_background; } - BackgroundItem* backgroundItem() const { return m_background.currentItem(); } + SelectionProperty<BackgroundItemCatalog>& background() { return m_background; } + BackgroundItem* backgroundItem() const { return m_background.currentItem(); } virtual std::vector<int> shape() const = 0; @@ -175,8 +175,8 @@ public: template <typename T> T* setDetectorType(); - DetectorItem* detectorItem() const { return m_detector.currentItem(); } - SelectionProperty<DetectorItemCatalog>& detector() { return m_detector; } + DetectorItem* detectorItem() const { return m_detector.currentItem(); } + SelectionProperty<DetectorItemCatalog>& detector() { return m_detector; } void importMasks(const MaskContainerItem* maskContainer) override; diff --git a/GUI/Model/Sample/ParticleLayoutItem.cpp b/GUI/Model/Sample/ParticleLayoutItem.cpp index 8c6881df8a6725e50d4e6fc38e387482cee188ef..9f0a5b62613a6625e5659041a9d1191891f4227e 100644 --- a/GUI/Model/Sample/ParticleLayoutItem.cpp +++ b/GUI/Model/Sample/ParticleLayoutItem.cpp @@ -62,7 +62,8 @@ double ParticleLayoutItem::totalDensityValue() const } } - if (const auto* hd = dynamic_cast<const InterferenceHardDiskItem*>(m_interference.currentItem())) + if (const auto* hd = + dynamic_cast<const InterferenceHardDiskItem*>(m_interference.currentItem())) return hd->density(); ASSERT(false); diff --git a/GUI/Model/Sample/ParticleLayoutItem.h b/GUI/Model/Sample/ParticleLayoutItem.h index ee768ade11b00841a42d9b0ce13228feee128636..040732162ab06d73dfbe7202cb13c39a2a06f89c 100644 --- a/GUI/Model/Sample/ParticleLayoutItem.h +++ b/GUI/Model/Sample/ParticleLayoutItem.h @@ -60,9 +60,12 @@ public: QVector<ItemWithParticles*> containedItemsWithParticles() const; SelectionProperty<InterferenceItemCatalog>& interference() { return m_interference; } - const SelectionProperty<InterferenceItemCatalog>& interference() const { return m_interference; } - void setInterference(InterferenceItem* i) { m_interference.setCurrentItem(i); } - void removeInterference() { m_interference.setCurrentItem(nullptr); } + const SelectionProperty<InterferenceItemCatalog>& interference() const + { + return m_interference; + } + void setInterference(InterferenceItem* i) { m_interference.setCurrentItem(i); } + void removeInterference() { m_interference.setCurrentItem(nullptr); } //! Returns whether total density is defined by the currently selected interference. //! diff --git a/GUI/View/Instrument/DistributionEditor.cpp b/GUI/View/Instrument/DistributionEditor.cpp index 2309804c8117047d4959e02601acd9a09b9888be..c9e866bb995786888a5834f1e69c6d876560336f 100644 --- a/GUI/View/Instrument/DistributionEditor.cpp +++ b/GUI/View/Instrument/DistributionEditor.cpp @@ -45,11 +45,10 @@ DistributionSelector::DistributionSelector(std::optional<MeanConfig> mean_config m_formLayout = new QFormLayout(this); m_formLayout->setContentsMargins(0, 0, 0, 0); - m_distributionCombo = - GUI::Util::createComboBoxFromProperty(item->distribution(), [=](int) { - createDistributionWidgets(); - emit distributionChanged(); - }); + m_distributionCombo = GUI::Util::createComboBoxFromProperty(item->distribution(), [=](int) { + createDistributionWidgets(); + emit distributionChanged(); + }); m_formLayout->addRow("Distribution:", m_distributionCombo); createDistributionWidgets(); @@ -86,7 +85,8 @@ void DistributionSelector::createDistributionWidgets() createSpinBox(gauss->standardDeviation()); createNumSamplesSpinBox(gauss); createSpinBox(gauss->sigmaFactor()); - } else if (auto* logNormal = dynamic_cast<DistributionLogNormalItem*>(m_item->distributionItem())) { + } else if (auto* logNormal = + dynamic_cast<DistributionLogNormalItem*>(m_item->distributionItem())) { createSpinBox(logNormal->median()); createSpinBox(logNormal->scaleParameter()); createNumSamplesSpinBox(logNormal); @@ -98,7 +98,8 @@ void DistributionSelector::createDistributionWidgets() createSpinBox(lorentz->sigmaFactor()); } else if (auto* none = dynamic_cast<DistributionNoneItem*>(m_item->distributionItem())) { createMeanSpinBox(none->mean()); - } else if (auto* trapezoid = dynamic_cast<DistributionTrapezoidItem*>(m_item->distributionItem())) { + } else if (auto* trapezoid = + dynamic_cast<DistributionTrapezoidItem*>(m_item->distributionItem())) { createSpinBox(trapezoid->center()); createSpinBox(trapezoid->leftWidth()); createSpinBox(trapezoid->middleWidth()); diff --git a/GUI/View/Instrument/ResolutionFunctionEditor.cpp b/GUI/View/Instrument/ResolutionFunctionEditor.cpp index 6d96f4c20d94bb354c9d4bc5d42f453bfcf85d9d..4518aac1a543ad1fc55a28aaaa042e75d5b650bb 100644 --- a/GUI/View/Instrument/ResolutionFunctionEditor.cpp +++ b/GUI/View/Instrument/ResolutionFunctionEditor.cpp @@ -31,11 +31,10 @@ ResolutionFunctionEditor::ResolutionFunctionEditor(Unit unit, QWidget* parent, D m_formLayout = new QFormLayout(this); m_formLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint); - auto* typeCombo = - GUI::Util::createComboBoxFromProperty(item->resolutionFunction(), [=](int) { - createResolutionWidgets(); - emit dataChanged(); - }); + auto* typeCombo = GUI::Util::createComboBoxFromProperty(item->resolutionFunction(), [=](int) { + createResolutionWidgets(); + emit dataChanged(); + }); m_formLayout->addRow("Type:", typeCombo); GroupBoxCollapser::installIntoGroupBox(this); diff --git a/GUI/View/SampleDesigner/CoreAndShellForm.cpp b/GUI/View/SampleDesigner/CoreAndShellForm.cpp index 700b743feb1145b5163b647a73faaf8cb723e7d6..1943c2c1f6cecff7b34ef10a386fcca4d336b118 100644 --- a/GUI/View/SampleDesigner/CoreAndShellForm.cpp +++ b/GUI/View/SampleDesigner/CoreAndShellForm.cpp @@ -92,7 +92,8 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* item, shellParticleGroup->setObjectName("Particle"); shell.layouter = std::make_unique<FormLayouter>(shellParticleGroup, ec); shell.formfactorCombo = createFormFactorCombo( - shellParticleGroup, item->shell() != nullptr ? item->shell()->formfactorItem() : nullptr); + shellParticleGroup, + item->shell() != nullptr ? item->shell()->formfactorItem() : nullptr); connect(shell.formfactorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CoreAndShellForm::onShellComboChanged); shell.layouter->addRow("Form factor:", shell.formfactorCombo); @@ -161,7 +162,8 @@ void CoreAndShellForm::createCoreWidgets() const QString formfactor = FormFactorItemCatalog::menuEntry(particle->formfactorItem()); groupTitle += " (" + formfactor + ")"; - core.layouter->addGroupOfValues("Geometry", particle->formfactorItem()->geometryProperties()); + core.layouter->addGroupOfValues("Geometry", + particle->formfactorItem()->geometryProperties()); core.layouter->addVector(particle->position(), false); core.layouter->addSelection(particle->rotation()); // no abundance since this is handled in CoreShell itself! @@ -178,7 +180,8 @@ void CoreAndShellForm::createShellWidgets() const QString formfactor = FormFactorItemCatalog::menuEntry(particle->formfactorItem()); groupTitle += " (" + formfactor + ")"; - shell.layouter->addGroupOfValues("Geometry", particle->formfactorItem()->geometryProperties()); + shell.layouter->addGroupOfValues("Geometry", + particle->formfactorItem()->geometryProperties()); shell.layouter->addSelection(particle->rotation()); // no position vector - not allowed in CoreShell // no abundance since this is handled in CoreShell itself! diff --git a/GUI/View/SampleDesigner/LayerEditorUtils.cpp b/GUI/View/SampleDesigner/LayerEditorUtils.cpp index 865d3dd1f5afc68248f7882d6c7b1e6acb92d7fc..85d3af163c14d93f67f594ca6ece2150707ea1de 100644 --- a/GUI/View/SampleDesigner/LayerEditorUtils.cpp +++ b/GUI/View/SampleDesigner/LayerEditorUtils.cpp @@ -117,8 +117,8 @@ void LayerEditorUtils::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int fir const DoublePropertyRefs& valueProperties, SampleEditorController* ec, bool addSpacer) { - addMultiPropertyToGrid(m_gridLayout, firstCol, valueProperties, ec, - valueProperties.size() > 1, addSpacer); + addMultiPropertyToGrid(m_gridLayout, firstCol, valueProperties, ec, valueProperties.size() > 1, + addSpacer); } void LayerEditorUtils::addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v, diff --git a/GUI/View/SampleDesigner/SampleEditorController.h b/GUI/View/SampleDesigner/SampleEditorController.h index 7eb09f9e27eceaea431ddd7fe0e0bbda652fe516..ac243dcc9ef0271bcd5f996c52718821490aa6b9 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.h +++ b/GUI/View/SampleDesigner/SampleEditorController.h @@ -94,7 +94,7 @@ public: void setDoubleFromUndo(double newValue, const QString& path); void setCurrentIndex(AbstractSelectionContainerForm* widget, int index, - AbstractSelectionProperty &d); + AbstractSelectionProperty& d); void selectMaterial(ItemWithMaterial* item, const QString& newMaterialIdentifier); void setMaterialValue(ItemWithMaterial* item, double newValue, DoubleProperty& d); diff --git a/GUI/View/SampleDesigner/SelectionContainerForm.h b/GUI/View/SampleDesigner/SelectionContainerForm.h index c869a97b39f8606393e78cf0fdecf0b180a56032..b5051e35d9ced21687dc74776b67ca7a98341be9 100644 --- a/GUI/View/SampleDesigner/SelectionContainerForm.h +++ b/GUI/View/SampleDesigner/SelectionContainerForm.h @@ -86,7 +86,8 @@ protected: //! expect the template type you defined for SelectionProperty. //! //! Example: -//! SelectionProperty<RotationItemCatalog> => LayerEditorUtils::doublePropertiesOfItem(RotationItem*) +//! SelectionProperty<RotationItemCatalog> => +//! LayerEditorUtils::doublePropertiesOfItem(RotationItem*) //! //! The connection from selection combo -> SelectionProperty is made via //! SampleEditorController::setCurrentIndex(), where a command can be used for undo purposes. @@ -100,8 +101,7 @@ protected: class SelectionContainerForm : public AbstractSelectionContainerForm { public: template <typename T> - SelectionContainerForm(QWidget* parent, SelectionProperty<T>& d, - SampleEditorController* ec) + SelectionContainerForm(QWidget* parent, SelectionProperty<T>& d, SampleEditorController* ec) : AbstractSelectionContainerForm(parent, ec) { if (d.currentItem() != nullptr) diff --git a/GUI/View/Tool/WidgetUtils.cpp b/GUI/View/Tool/WidgetUtils.cpp index 7a1f9168a226b63632a104c6d4f46a9f8d05119a..a1152172f6a617312dc14d2fe1a5298991888dbe 100644 --- a/GUI/View/Tool/WidgetUtils.cpp +++ b/GUI/View/Tool/WidgetUtils.cpp @@ -12,11 +12,11 @@ // // ************************************************************************************************ +#include "GUI/View/Tool/WidgetUtils.h" #include "GUI/Util/ComboProperty.h" #include "GUI/View/Common/DoubleSpinBox.h" #include "GUI/View/Common/ScientificSpinBox.h" #include "GUI/View/Tool/EditUtil.h" -#include "GUI/View/Tool/WidgetUtils.h" #include <QCheckBox> #include <QFormLayout> #include <QLabel> diff --git a/GUI/View/Tool/WidgetUtils.h b/GUI/View/Tool/WidgetUtils.h index a813d7d3a29f3f3fc47a9181ca4c1c02c7c51723..8c1b8b6c7b99fe5860a3a4e41c6898671f4bb545 100644 --- a/GUI/View/Tool/WidgetUtils.h +++ b/GUI/View/Tool/WidgetUtils.h @@ -65,8 +65,8 @@ QComboBox* createSafeComboBox(std::function<ComboProperty()> comboFunction, //! template <typename T> QComboBox* createComboBoxFromProperty(SelectionProperty<T>& d, - std::function<void(int)> slot = nullptr, - bool isScrollable = false) + std::function<void(int)> slot = nullptr, + bool isScrollable = false) { QComboBox* combo = new QComboBox; combo->addItems(d.options());