BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
MaskEditor Class Reference

Description

Main class to draw masks on top of intensity data map.

Definition at line 31 of file MaskEditor.h.

Inheritance diagram for MaskEditor:
[legend]
Collaboration diagram for MaskEditor:
[legend]

Public Slots

void onPropertyPanelRequest ()
 shows/hides right panel with properties More...
 
void resetContext ()
 
void setMaskContext (SessionModel *model, const QModelIndex &maskContainerIndex, IntensityDataItem *intensityItem)
 Main method to setup context for mask editing. More...
 
QList< QAction * > topToolbarActions ()
 Returns list of actions intended for styled toolbar (on the top). More...
 

Public Member Functions

 MaskEditor (QWidget *parent=nullptr)
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *event) override
 Context menu reimplemented to supress default menu. More...
 

Private Member Functions

void setup_connections ()
 

Private Attributes

MaskEditorActionsm_editorActions
 
MaskEditorCanvasm_editorCanvas
 
MaskEditorPropertyPanelm_editorPropertyPanel
 
MaskEditorToolbarm_toolbar
 

Constructor & Destructor Documentation

◆ MaskEditor()

MaskEditor::MaskEditor ( QWidget *  parent = nullptr)

Definition at line 27 of file MaskEditor.cpp.

28  : QMainWindow(parent)
33 {
34  setObjectName("MaskEditor");
35  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
36 
37  auto* splitter = new QSplitter;
38  splitter->addWidget(m_editorCanvas);
39  splitter->addWidget(m_editorPropertyPanel);
40  splitter->setCollapsible(1, true);
41 
42  addToolBar(Qt::RightToolBarArea, m_toolbar);
43 
44  setCentralWidget(splitter);
45 
47 
49 }
Defines actions for MaskEditor which are related to selected MaskItem (toggle mask value,...
Painting widget for MaskEditor, contains graphics scene and graphics view.
Tool widget for MaskEditor.
void setPanelHidden(bool hidden)
Show/Hide panel. When panel is hidden, all property editors are disabled.
Main class to draw masks on top of intensity data map.
MaskEditorCanvas * m_editorCanvas
Definition: MaskEditor.h:59
MaskEditorToolbar * m_toolbar
Definition: MaskEditor.h:57
void setup_connections()
Definition: MaskEditor.cpp:92
MaskEditorActions * m_editorActions
Definition: MaskEditor.h:56
MaskEditorPropertyPanel * m_editorPropertyPanel
Definition: MaskEditor.h:58

References m_editorCanvas, m_editorPropertyPanel, m_toolbar, MaskEditorPropertyPanel::setPanelHidden(), and setup_connections().

Here is the call graph for this function:

Member Function Documentation

◆ contextMenuEvent()

void MaskEditor::contextMenuEvent ( QContextMenuEvent *  event)
overrideprotected

Context menu reimplemented to supress default menu.

Definition at line 80 of file MaskEditor.cpp.

81 {
82  Q_UNUSED(event);
83 }

◆ onPropertyPanelRequest

void MaskEditor::onPropertyPanelRequest ( )
slot

shows/hides right panel with properties

Definition at line 74 of file MaskEditor.cpp.

References m_editorPropertyPanel, and MaskEditorPropertyPanel::setPanelHidden().

Referenced by setup_connections().

Here is the call graph for this function:

◆ resetContext

void MaskEditor::resetContext ( )
slot

Definition at line 67 of file MaskEditor.cpp.

References m_editorCanvas, m_editorPropertyPanel, MaskEditorCanvas::resetContext(), and MaskEditorPropertyPanel::resetContext().

Referenced by RealDataMaskWidget::unsubscribeFromItem().

Here is the call graph for this function:

◆ setMaskContext

void MaskEditor::setMaskContext ( SessionModel model,
const QModelIndex &  maskContainerIndex,
IntensityDataItem intensityItem 
)
slot

Main method to setup context for mask editing.

model The model which will hold all masks
maskContainerIndex Index of top level MaskContainerItem in the model to hold masks
intensityItem IntensityDataItem which will be used as background for Mask drawing

Definition at line 51 of file MaskEditor.cpp.

53 {
54  m_editorPropertyPanel->setMaskContext(model, maskContainerIndex, intensityItem);
55 
56  ASSERT(intensityItem);
57  ASSERT(maskContainerIndex.isValid());
58  ASSERT(model->itemForIndex(maskContainerIndex)->modelType() == MaskContainerItem::M_TYPE);
59 
61  m_editorCanvas->setMaskContext(model, maskContainerIndex, intensityItem);
62 
63  m_editorActions->setModel(model, maskContainerIndex);
65 }
static constexpr auto M_TYPE
Definition: MaskItems.h:204
void setModel(SessionModel *maskModel, const QModelIndex &rootIndex)
void setSelectionModel(QItemSelectionModel *selectionModel)
void setSelectionModel(QItemSelectionModel *model)
void setMaskContext(SessionModel *model, const QModelIndex &maskContainerIndex, IntensityDataItem *intensityItem)
void setMaskContext(SessionModel *model, const QModelIndex &maskContainerIndex, IntensityDataItem *intensityItem)
QItemSelectionModel * selectionModel()
QString modelType() const
Get model type.
SessionItem * itemForIndex(const QModelIndex &index) const

References SessionModel::itemForIndex(), m_editorActions, m_editorCanvas, m_editorPropertyPanel, MaskContainerItem::M_TYPE, SessionItem::modelType(), MaskEditorPropertyPanel::selectionModel(), MaskEditorCanvas::setMaskContext(), MaskEditorPropertyPanel::setMaskContext(), MaskEditorActions::setModel(), MaskEditorCanvas::setSelectionModel(), and MaskEditorActions::setSelectionModel().

Referenced by RealDataMaskWidget::subscribeToItem().

Here is the call graph for this function:

◆ setup_connections()

void MaskEditor::setup_connections ( )
private

Definition at line 92 of file MaskEditor.cpp.

93 {
94  // reset view request is propagated from editorActions to graphics view
97 
98  // tool panel request is propagated from editorActions to this MaskEditor
101 
102  // save plot request is propagated from editorActions to graphics scene
105 
106  // selection/drawing activity is propagated from Toolbar to graphics scene
109 
110  // mask value is propagated from Toolbar to graphics scene
113 
114  // show results request is propagated from Toolbar to Canvas
117 
118  // space bar push (request for zoom mode) is propagated from graphics view to Toolbar
121 
122  // Delete request is propagated from canvas to actions
125 
126  // context menu request is propagated from graphics scene to MaskEditorActions
129 
130  // context menu request is propagated from PropertyPanel to MaskEditorActions
133 }
void propertyPanelRequest()
void onItemContextMenuRequest(const QPoint &point)
Constructs MaskItem context menu following the request from MaskGraphicsScene or MaskEditorInfoPanel.
void deleteSelectedRequest()
void onSavePlotRequest()
Saves plot into project directory.
void changeActivityRequest(MaskEditorFlags::Activity)
MaskGraphicsScene * getScene()
void onPresentationTypeRequest(MaskEditorFlags::PresentationType presentationType)
void itemContextMenuRequest(const QPoint &point)
void maskValueChanged(MaskEditorFlags::MaskValue)
void activityModeChanged(MaskEditorFlags::Activity)
void onChangeActivityRequest(MaskEditorFlags::Activity value)
Handles ZOOM requests from MaskGraphicsView while user press and holds space bar. As soon as space ba...
void presentationTypeRequest(MaskEditorFlags::PresentationType)
void onPropertyPanelRequest()
shows/hides right panel with properties
Definition: MaskEditor.cpp:74
void onMaskValueChanged(MaskEditorFlags::MaskValue value)
void itemContextMenuRequest(const QPoint &point)
void onActivityModeChanged(MaskEditorFlags::Activity value)

References MaskEditorToolbar::activityModeChanged(), MaskEditorCanvas::changeActivityRequest(), MaskEditorCanvas::deleteSelectedRequest(), MaskEditorCanvas::getScene(), MaskEditorPropertyPanel::itemContextMenuRequest(), MaskGraphicsScene::itemContextMenuRequest(), m_editorActions, m_editorCanvas, m_editorPropertyPanel, m_toolbar, MaskEditorToolbar::maskValueChanged(), MaskGraphicsScene::onActivityModeChanged(), MaskEditorToolbar::onChangeActivityRequest(), MaskEditorActions::onDeleteMaskAction(), MaskEditorActions::onItemContextMenuRequest(), MaskGraphicsScene::onMaskValueChanged(), MaskEditorCanvas::onPresentationTypeRequest(), onPropertyPanelRequest(), MaskEditorCanvas::onResetViewRequest(), MaskEditorCanvas::onSavePlotRequest(), MaskEditorToolbar::presentationTypeRequest(), MaskEditorActions::propertyPanelRequest(), MaskEditorActions::resetViewRequest(), and MaskEditorActions::savePlotRequest().

Referenced by MaskEditor().

Here is the call graph for this function:

◆ topToolbarActions

QList< QAction * > MaskEditor::topToolbarActions ( )
slot

Returns list of actions intended for styled toolbar (on the top).

Definition at line 87 of file MaskEditor.cpp.

88 {
90 }
QList< QAction * > topToolbarActions()

References m_editorActions, and MaskEditorActions::topToolbarActions().

Referenced by RealDataMaskWidget::actionList().

Here is the call graph for this function:

Member Data Documentation

◆ m_editorActions

MaskEditorActions* MaskEditor::m_editorActions
private

Definition at line 56 of file MaskEditor.h.

Referenced by setMaskContext(), setup_connections(), and topToolbarActions().

◆ m_editorCanvas

MaskEditorCanvas* MaskEditor::m_editorCanvas
private

Definition at line 59 of file MaskEditor.h.

Referenced by MaskEditor(), resetContext(), setMaskContext(), and setup_connections().

◆ m_editorPropertyPanel

MaskEditorPropertyPanel* MaskEditor::m_editorPropertyPanel
private

◆ m_toolbar

MaskEditorToolbar* MaskEditor::m_toolbar
private

Definition at line 57 of file MaskEditor.h.

Referenced by MaskEditor(), and setup_connections().


The documentation for this class was generated from the following files: