BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ProjectionsEditor.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/JobWidgets/ProjectionsEditor.cpp
6 //! @brief Implements class ProjectionsEditor
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
23 #include <QItemSelectionModel>
24 #include <QSplitter>
25 
27  : QMainWindow(parent)
28  , m_editorActions(new ProjectionsEditorActions(this))
29  , m_toolBar(new ProjectionsToolBar(m_editorActions))
30  , m_projectionsCanvas(new ProjectionsEditorCanvas)
31  , m_projectionsWidget(new ProjectionsWidget)
32  , m_propertyPanel(new ProjectionsPropertyPanel)
33  , m_selectionModel(nullptr)
34 {
35  addToolBar(Qt::RightToolBarArea, m_toolBar);
36 
37  auto bottomSplitter = new QSplitter;
38  bottomSplitter->setOrientation(Qt::Vertical);
39  bottomSplitter->addWidget(m_projectionsCanvas);
40  bottomSplitter->addWidget(m_projectionsWidget);
41 
42  auto rightSplitter(new QSplitter);
43  rightSplitter->addWidget(bottomSplitter);
44  rightSplitter->addWidget(m_propertyPanel);
45 
46  setCentralWidget(rightSplitter);
47 
48  m_propertyPanel->setHidden(true);
50 }
51 
52 void ProjectionsEditor::setContext(SessionModel* model, const QModelIndex& shapeContainerIndex,
53  IntensityDataItem* intensityItem)
54 {
55  Q_UNUSED(model);
56  Q_UNUSED(shapeContainerIndex);
57 
58  delete m_selectionModel;
59  m_selectionModel = new QItemSelectionModel(model, this);
60 
61  m_propertyPanel->setItem(intensityItem);
63  m_projectionsCanvas->setContext(model, shapeContainerIndex, intensityItem);
64  m_projectionsWidget->setItem(intensityItem);
65 
66  m_editorActions->setContext(model, shapeContainerIndex, intensityItem);
68 }
69 
71 {
72  m_propertyPanel->setItem(nullptr);
74  m_projectionsWidget->setItem(nullptr);
75 }
76 
78 {
80 }
81 
83 {
84  // tool panel request is propagated from editorActions to this MaskEditor
87 
88  // tool panel request is propagated from editorActions to this MaskEditor
90  [=]() { m_propertyPanel->setHidden(!m_propertyPanel->isHidden()); });
91 
92  // selection/drawing activity is propagated from ToolBar to graphics scene
95 
96  // selection/drawing activity is propagated from ToolBar to Projections Widget
99 
100  // click on projections tab is propagated to tool bar
103 
104  // Delete request is propagated from canvas to actions
107 
108  // space bar push (request for zoom mode) is propagated from graphics view to ToolBar
111 
112  // ColorMap margins changed, canvas -> projection widget
115 
117 }
Defines class IntensityDataItem.
Defines class ProjectionsEditorActions.
Defines class ProjectionsEditorCanvas.
Defines class ProjectionsEditor.
Defines class ProjectionsPropertyPanel.
Defines class ProjectionsToolBar.
Defines class ProjectionsWidget.
Defines class SessionModel.
Provides various actions for ProjectionsEditor.
void setContext(SessionModel *model, const QModelIndex &shapeContainerIndex, IntensityDataItem *intensityItem)
void setSelectionModel(QItemSelectionModel *selectionModel)
QList< QAction * > topToolBarActions()
Holds a graphics scene to draw projections on top of ColorMap.
void setSelectionModel(QItemSelectionModel *model)
void onActivityModeChanged(MaskEditorFlags::Activity value)
void changeActivityRequest(MaskEditorFlags::Activity)
void setContext(SessionModel *model, const QModelIndex &shapeContainerIndex, IntensityDataItem *intensityItem)
void marginsChanged(double left, double right)
ProjectionsEditor(QWidget *parent=nullptr)
QList< QAction * > topToolBarActions()
ProjectionsEditorCanvas * m_projectionsCanvas
main tool bar with bottoms at the right
void setContext(SessionModel *model, const QModelIndex &shapeContainerIndex, IntensityDataItem *intensityItem)
ProjectionsToolBar * m_toolBar
QItemSelectionModel * m_selectionModel
pannel at the right with properties
ProjectionsEditorActions * m_editorActions
ProjectionsPropertyPanel * m_propertyPanel
bottom widget to draw projections plot
ProjectionsWidget * m_projectionsWidget
canvas with color map at the top
Toolbar with projections buttons (horizontal projections, vertical projections, select,...
void onProjectionTabChange(MaskEditorFlags::Activity value)
Change activity only if current activity is one of drawing mode (horizontal, vertical projections dra...
void activityModeChanged(MaskEditorFlags::Activity)
void onChangeActivityRequest(MaskEditorFlags::Activity value)
Holds tabs of vertical and horizontal projections, located at the bottom of ProjectionsEditor.
void changeActivityRequest(MaskEditorFlags::Activity value)
void setItem(SessionItem *intensityItem)
void onActivityModeChanged(MaskEditorFlags::Activity value)
void onMarginsChanged(double left, double right)
virtual void setItem(SessionItem *item)