From ed016b7009e9445d219bd9c44f2a05714c41a74b Mon Sep 17 00:00:00 2001 From: Matthias Puchner <github@mpuchner.de> Date: Tue, 16 Nov 2021 11:31:08 +0100 Subject: [PATCH] rm overdone indirection; use dedicated IntensityDataPropertyWidget instead of general approach --- GUI/View/Compare/FitComparisonWidget.cpp | 2 +- GUI/View/Compare/FitComparisonWidget1D.cpp | 2 +- GUI/View/Intensity/IntensityDataWidget.cpp | 2 +- GUI/View/Mask/MaskEditorPropertyPanel.cpp | 5 +- GUI/View/Mask/MaskEditorPropertyPanel.h | 3 +- GUI/View/Projection/ProjectionsEditor.cpp | 4 +- GUI/View/Projection/ProjectionsEditor.h | 4 +- .../Projection/ProjectionsPropertyPanel.cpp | 50 ------------------- .../Projection/ProjectionsPropertyPanel.h | 39 --------------- .../IntensityDataPropertyWidget.cpp | 6 ++- .../IntensityDataPropertyWidget.h | 8 +-- GUI/View/SpecularData/SpecularDataWidget.cpp | 2 +- 12 files changed, 20 insertions(+), 107 deletions(-) delete mode 100644 GUI/View/Projection/ProjectionsPropertyPanel.cpp delete mode 100644 GUI/View/Projection/ProjectionsPropertyPanel.h rename GUI/View/{Intensity => PropertyEditor}/IntensityDataPropertyWidget.cpp (93%) rename GUI/View/{Intensity => PropertyEditor}/IntensityDataPropertyWidget.h (82%) diff --git a/GUI/View/Compare/FitComparisonWidget.cpp b/GUI/View/Compare/FitComparisonWidget.cpp index f024a0dfa00..5c97c32edfb 100644 --- a/GUI/View/Compare/FitComparisonWidget.cpp +++ b/GUI/View/Compare/FitComparisonWidget.cpp @@ -21,8 +21,8 @@ #include "GUI/View/Compare/FitFlowWidget.h" #include "GUI/View/Intensity/ColorMap.h" #include "GUI/View/Intensity/ColorMapCanvas.h" -#include "GUI/View/Intensity/IntensityDataPropertyWidget.h" #include "GUI/View/Intensity/PlotStatusLabel.h" +#include "GUI/View/PropertyEditor/IntensityDataPropertyWidget.h" #include <QAction> #include <QGridLayout> #include <QVBoxLayout> diff --git a/GUI/View/Compare/FitComparisonWidget1D.cpp b/GUI/View/Compare/FitComparisonWidget1D.cpp index 31f56648471..987825fde2d 100644 --- a/GUI/View/Compare/FitComparisonWidget1D.cpp +++ b/GUI/View/Compare/FitComparisonWidget1D.cpp @@ -19,9 +19,9 @@ #include "GUI/Model/Job/JobItem.h" #include "GUI/View/Compare/FitComparisonViewController.h" #include "GUI/View/Compare/FitFlowWidget.h" -#include "GUI/View/Intensity/IntensityDataPropertyWidget.h" #include "GUI/View/Intensity/Plot1D.h" #include "GUI/View/Intensity/PlotStatusLabel.h" +#include "GUI/View/PropertyEditor/IntensityDataPropertyWidget.h" #include "GUI/View/SpecularData/Plot1DCanvas.h" #include <QAction> #include <QGridLayout> diff --git a/GUI/View/Intensity/IntensityDataWidget.cpp b/GUI/View/Intensity/IntensityDataWidget.cpp index 7c20e42e8e6..c54272d6d25 100644 --- a/GUI/View/Intensity/IntensityDataWidget.cpp +++ b/GUI/View/Intensity/IntensityDataWidget.cpp @@ -17,7 +17,7 @@ #include "GUI/Model/Data/IntensityDataItem.h" #include "GUI/View/Intensity/IntensityDataCanvas.h" #include "GUI/View/Intensity/IntensityDataFFTPresenter.h" -#include "GUI/View/Intensity/IntensityDataPropertyWidget.h" +#include "GUI/View/PropertyEditor//IntensityDataPropertyWidget.h" #include <QBoxLayout> #include <QMenu> diff --git a/GUI/View/Mask/MaskEditorPropertyPanel.cpp b/GUI/View/Mask/MaskEditorPropertyPanel.cpp index b56ca1f97e0..b306d4702de 100644 --- a/GUI/View/Mask/MaskEditorPropertyPanel.cpp +++ b/GUI/View/Mask/MaskEditorPropertyPanel.cpp @@ -16,6 +16,7 @@ #include "GUI/Model/Data/IntensityDataItem.h" #include "GUI/Model/Session/SessionModel.h" #include "GUI/View/PropertyEditor/ComponentTreeView.h" +#include "GUI/View/PropertyEditor/IntensityDataPropertyWidget.h" #include "GUI/View/Tool/GroupBoxCollapser.h" #include <QGroupBox> @@ -26,7 +27,7 @@ MaskEditorPropertyPanel::MaskEditorPropertyPanel(QWidget* parent) : QWidget(parent) , m_listView(new QListView) , m_maskPropertyEditor(new ComponentTreeView) - , m_plotPropertyEditor(new ComponentTreeView) + , m_plotPropertyEditor(new IntensityDataPropertyWidget) , m_maskModel(nullptr) , m_intensityDataItem(nullptr) { @@ -72,8 +73,6 @@ MaskEditorPropertyPanel::MaskEditorPropertyPanel(QWidget* parent) new QSpacerItem(0, 10, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding)); setLayout(mainLayout); - - m_plotPropertyEditor->setShowHeader(false); } QSize MaskEditorPropertyPanel::sizeHint() const diff --git a/GUI/View/Mask/MaskEditorPropertyPanel.h b/GUI/View/Mask/MaskEditorPropertyPanel.h index 72b56716633..8aeae2e3d63 100644 --- a/GUI/View/Mask/MaskEditorPropertyPanel.h +++ b/GUI/View/Mask/MaskEditorPropertyPanel.h @@ -25,6 +25,7 @@ class ComponentTreeView; class QItemSelection; class QItemSelectionModel; class IntensityDataItem; +class IntensityDataPropertyWidget; //! Tool widget for MaskEditor @@ -55,7 +56,7 @@ private slots: private: QListView* m_listView; ComponentTreeView* m_maskPropertyEditor; - ComponentTreeView* m_plotPropertyEditor; + IntensityDataPropertyWidget* m_plotPropertyEditor; SessionModel* m_maskModel; QModelIndex m_rootIndex; IntensityDataItem* m_intensityDataItem; diff --git a/GUI/View/Projection/ProjectionsEditor.cpp b/GUI/View/Projection/ProjectionsEditor.cpp index 67c708b7c0b..04045c0c401 100644 --- a/GUI/View/Projection/ProjectionsEditor.cpp +++ b/GUI/View/Projection/ProjectionsEditor.cpp @@ -17,9 +17,9 @@ #include "GUI/Model/Session/SessionModel.h" #include "GUI/View/Projection/ProjectionsEditorActions.h" #include "GUI/View/Projection/ProjectionsEditorCanvas.h" -#include "GUI/View/Projection/ProjectionsPropertyPanel.h" #include "GUI/View/Projection/ProjectionsToolBar.h" #include "GUI/View/Projection/ProjectionsWidget.h" +#include "GUI/View/PropertyEditor/IntensityDataPropertyWidget.h" #include <QItemSelectionModel> #include <QSplitter> @@ -29,7 +29,7 @@ ProjectionsEditor::ProjectionsEditor(QWidget* parent) , m_toolBar(new ProjectionsToolBar(m_editorActions)) , m_projectionsCanvas(new ProjectionsEditorCanvas) , m_projectionsWidget(new ProjectionsWidget) - , m_propertyPanel(new ProjectionsPropertyPanel) + , m_propertyPanel(new IntensityDataPropertyWidget) , m_selectionModel(nullptr) { addToolBar(Qt::RightToolBarArea, m_toolBar); diff --git a/GUI/View/Projection/ProjectionsEditor.h b/GUI/View/Projection/ProjectionsEditor.h index 0d3448e5259..c1dd54eb3d8 100644 --- a/GUI/View/Projection/ProjectionsEditor.h +++ b/GUI/View/Projection/ProjectionsEditor.h @@ -24,9 +24,9 @@ class ProjectionsToolBar; class ProjectionsEditorActions; class ProjectionsActions; class ProjectionsEditorCanvas; -class ProjectionsPropertyPanel; class ProjectionsWidget; class QItemSelectionModel; +class IntensityDataPropertyWidget; //! Editor to draw projections on top of intensity plot. Part of @@ -50,7 +50,7 @@ private: ProjectionsToolBar* m_toolBar; //! main tool bar with bottoms at the right ProjectionsEditorCanvas* m_projectionsCanvas; //! canvas with color map at the top ProjectionsWidget* m_projectionsWidget; //! bottom widget to draw projections plot - ProjectionsPropertyPanel* m_propertyPanel; //! pannel at the right with properties + IntensityDataPropertyWidget* m_propertyPanel; //! panel at the right with properties QItemSelectionModel* m_selectionModel; }; diff --git a/GUI/View/Projection/ProjectionsPropertyPanel.cpp b/GUI/View/Projection/ProjectionsPropertyPanel.cpp deleted file mode 100644 index 1f9a2d16080..00000000000 --- a/GUI/View/Projection/ProjectionsPropertyPanel.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file GUI/View/Projection/ProjectionsPropertyPanel.cpp -//! @brief Implements class ProjectionsPropertyPanel -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2018 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#include "GUI/View/Projection/ProjectionsPropertyPanel.h" -#include "GUI/View/PropertyEditor/ComponentTreeView.h" -#include <QVBoxLayout> - -ProjectionsPropertyPanel::ProjectionsPropertyPanel(QWidget* parent) - : SessionItemWidget(parent), m_componentEditor(new ComponentTreeView) -{ - setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); - - auto* mainLayout = new QVBoxLayout; - mainLayout->setMargin(0); - mainLayout->setSpacing(0); - - mainLayout->addWidget(m_componentEditor); - setLayout(mainLayout); -} - -QSize ProjectionsPropertyPanel::sizeHint() const -{ - return QSize(230, 256); -} - -QSize ProjectionsPropertyPanel::minimumSizeHint() const -{ - return QSize(230, 64); -} - -void ProjectionsPropertyPanel::subscribeToItem() -{ - m_componentEditor->setItem(currentItem()); -} - -void ProjectionsPropertyPanel::unsubscribeFromItem() -{ - m_componentEditor->setItem(nullptr); -} diff --git a/GUI/View/Projection/ProjectionsPropertyPanel.h b/GUI/View/Projection/ProjectionsPropertyPanel.h deleted file mode 100644 index a23622e317c..00000000000 --- a/GUI/View/Projection/ProjectionsPropertyPanel.h +++ /dev/null @@ -1,39 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file GUI/View/Projection/ProjectionsPropertyPanel.h -//! @brief Defines class ProjectionsPropertyPanel -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2018 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#ifndef BORNAGAIN_GUI_VIEW_PROJECTION_PROJECTIONSPROPERTYPANEL_H -#define BORNAGAIN_GUI_VIEW_PROJECTION_PROJECTIONSPROPERTYPANEL_H - -#include "GUI/View/Common/SessionItemWidget.h" - -class ComponentTreeView; - -class ProjectionsPropertyPanel : public SessionItemWidget { - Q_OBJECT - -public: - ProjectionsPropertyPanel(QWidget* parent = nullptr); - - QSize sizeHint() const override; - QSize minimumSizeHint() const override; - -protected: - void subscribeToItem() override; - void unsubscribeFromItem() override; - -private: - ComponentTreeView* m_componentEditor; -}; - -#endif // BORNAGAIN_GUI_VIEW_PROJECTION_PROJECTIONSPROPERTYPANEL_H diff --git a/GUI/View/Intensity/IntensityDataPropertyWidget.cpp b/GUI/View/PropertyEditor/IntensityDataPropertyWidget.cpp similarity index 93% rename from GUI/View/Intensity/IntensityDataPropertyWidget.cpp rename to GUI/View/PropertyEditor/IntensityDataPropertyWidget.cpp index 344a9042b02..acda658790f 100644 --- a/GUI/View/Intensity/IntensityDataPropertyWidget.cpp +++ b/GUI/View/PropertyEditor/IntensityDataPropertyWidget.cpp @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/Intensity/IntensityDataPropertyWidget.cpp +//! @file GUI/View/PropertyEditor/IntensityDataPropertyWidget.cpp //! @brief Implements class IntensityDataPropertyWidget //! //! @homepage http://www.bornagainproject.org @@ -12,7 +12,7 @@ // // ************************************************************************************************ -#include "GUI/View/Intensity/IntensityDataPropertyWidget.h" +#include "GUI/View/PropertyEditor/IntensityDataPropertyWidget.h" #include "GUI/View/PropertyEditor/ComponentTreeView.h" #include "GUI/View/Tool/StyleUtils.h" #include <QAction> @@ -27,6 +27,8 @@ IntensityDataPropertyWidget::IntensityDataPropertyWidget(QWidget* parent) setWindowTitle(QLatin1String("Intensity Data Properties")); setObjectName(QLatin1String("Intensity Data Properties")); + m_componentEditor->setShowHeader(false); + auto* mainLayout = new QVBoxLayout; mainLayout->setMargin(0); mainLayout->setSpacing(0); diff --git a/GUI/View/Intensity/IntensityDataPropertyWidget.h b/GUI/View/PropertyEditor/IntensityDataPropertyWidget.h similarity index 82% rename from GUI/View/Intensity/IntensityDataPropertyWidget.h rename to GUI/View/PropertyEditor/IntensityDataPropertyWidget.h index 8f2ba787021..718b0487b16 100644 --- a/GUI/View/Intensity/IntensityDataPropertyWidget.h +++ b/GUI/View/PropertyEditor/IntensityDataPropertyWidget.h @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/Intensity/IntensityDataPropertyWidget.h +//! @file GUI/View/PropertyEditor/IntensityDataPropertyWidget.h //! @brief Defines class IntensityDataPropertyWidget //! //! @homepage http://www.bornagainproject.org @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_VIEW_INTENSITY_INTENSITYDATAPROPERTYWIDGET_H -#define BORNAGAIN_GUI_VIEW_INTENSITY_INTENSITYDATAPROPERTYWIDGET_H +#ifndef BORNAGAIN_GUI_VIEW_PROPERTYEDITOR_INTENSITYDATAPROPERTYWIDGET_H +#define BORNAGAIN_GUI_VIEW_PROPERTYEDITOR_INTENSITYDATAPROPERTYWIDGET_H #include "GUI/View/Common/SessionItemWidget.h" @@ -46,4 +46,4 @@ private: ComponentTreeView* m_componentEditor; }; -#endif // BORNAGAIN_GUI_VIEW_INTENSITY_INTENSITYDATAPROPERTYWIDGET_H +#endif // BORNAGAIN_GUI_VIEW_PROPERTYEDITOR_INTENSITYDATAPROPERTYWIDGET_H diff --git a/GUI/View/SpecularData/SpecularDataWidget.cpp b/GUI/View/SpecularData/SpecularDataWidget.cpp index f176a79783c..4764f853936 100644 --- a/GUI/View/SpecularData/SpecularDataWidget.cpp +++ b/GUI/View/SpecularData/SpecularDataWidget.cpp @@ -15,7 +15,7 @@ #include "GUI/View/SpecularData/SpecularDataWidget.h" #include "GUI/Model/Data/DataItemUtils.h" #include "GUI/Model/Data/SpecularDataItem.h" -#include "GUI/View/Intensity/IntensityDataPropertyWidget.h" +#include "GUI/View/PropertyEditor/IntensityDataPropertyWidget.h" #include "GUI/View/SpecularData/SpecularDataCanvas.h" #include <QBoxLayout> #include <QMenu> -- GitLab