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

Description

Provides various actions for ProjectionsEditor.

Definition at line 29 of file ProjectionsEditorActions.h.

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

Public Slots

void onDeleteAction ()
 
void onSaveAction ()
 Performs saving of projections in ascii file. More...
 

Signals

void propertyPanelRequest ()
 
void resetViewRequest ()
 

Public Member Functions

 ProjectionsEditorActions (QWidget *parent=nullptr)
 
void setContext (SessionModel *model, const QModelIndex &shapeContainerIndex, IntensityDataItem *intensityItem)
 
void setSelectionModel (QItemSelectionModel *selectionModel)
 
QList< QAction * > topToolbarActions ()
 

Private Attributes

QModelIndex m_containerIndex
 Index of container with projections. More...
 
QAction * m_deleteAction
 
IntensityDataItemm_intensityDataItem
 
SessionModelm_model
 
QWidget * m_parent
 
QAction * m_resetViewAction
 
QItemSelectionModel * m_selectionModel
 
QAction * m_togglePanelAction
 

Constructor & Destructor Documentation

◆ ProjectionsEditorActions()

ProjectionsEditorActions::ProjectionsEditorActions ( QWidget *  parent = nullptr)

Definition at line 22 of file ProjectionsEditorActions.cpp.

23  : QObject(parent)
24  , m_resetViewAction(new QAction(this))
25  , m_togglePanelAction(new QAction(this))
26  , m_deleteAction(new QAction("Remove selected", this))
27  , m_model(nullptr)
28  , m_intensityDataItem(nullptr)
29  , m_selectionModel(nullptr)
30  , m_parent(parent)
31 {
32  // Actions for top toolbar
33  m_resetViewAction->setText("Center view");
34  m_resetViewAction->setIcon(QIcon(":/images/camera-metering-center.svg"));
35  m_resetViewAction->setToolTip("Reset view\n"
36  "x,y,z axes range will be set to default");
37  connect(m_resetViewAction, &QAction::triggered, this,
39 
40  m_togglePanelAction->setText("Properties");
41  m_togglePanelAction->setIcon(QIcon(":/images/dock-right.svg"));
42  m_togglePanelAction->setToolTip("Toggle property panel");
43  connect(m_togglePanelAction, &QAction::triggered, this,
45 
46  m_deleteAction->setToolTip("Remove selected (Del)");
47  m_deleteAction->setShortcuts(QKeySequence::Delete);
48  connect(m_deleteAction, &QAction::triggered, this, &ProjectionsEditorActions::onDeleteAction);
49 }
IntensityDataItem * m_intensityDataItem
QItemSelectionModel * m_selectionModel

References m_deleteAction, m_resetViewAction, m_togglePanelAction, onDeleteAction(), propertyPanelRequest(), and resetViewRequest().

Here is the call graph for this function:

Member Function Documentation

◆ onDeleteAction

void ProjectionsEditorActions::onDeleteAction ( )
slot

Definition at line 69 of file ProjectionsEditorActions.cpp.

70 {
71  ASSERT(m_model);
72  ASSERT(m_selectionModel);
73 
74  QModelIndexList indexes = m_selectionModel->selectedIndexes();
75  while (!indexes.empty()) {
76  m_model->removeRows(indexes.back().row(), 1, indexes.back().parent());
77  indexes = m_selectionModel->selectedIndexes();
78  }
79 }
bool removeRows(int row, int count, const QModelIndex &parent) override

References m_model, m_selectionModel, and SessionModel::removeRows().

Referenced by ProjectionsEditorActions(), and ProjectionsEditor::setup_connections().

Here is the call graph for this function:

◆ onSaveAction

void ProjectionsEditorActions::onSaveAction ( )
slot

Performs saving of projections in ascii file.

Definition at line 82 of file ProjectionsEditorActions.cpp.

83 {
85  return;
86 
87  SaveProjectionsAssistant assistant;
89 }
Assistant class which save all projections of IndensityDataItem into ASCII file.
void saveProjections(QWidget *parent, IntensityDataItem *intensityItem)
Calls file open dialog and writes projection data as ASCII.

References m_intensityDataItem, m_parent, and SaveProjectionsAssistant::saveProjections().

Referenced by ProjectionsToolbar::setup_extratools_group().

Here is the call graph for this function:

◆ propertyPanelRequest

void ProjectionsEditorActions::propertyPanelRequest ( )
signal

◆ resetViewRequest

void ProjectionsEditorActions::resetViewRequest ( )
signal

◆ setContext()

void ProjectionsEditorActions::setContext ( SessionModel model,
const QModelIndex &  shapeContainerIndex,
IntensityDataItem intensityItem 
)

Definition at line 51 of file ProjectionsEditorActions.cpp.

53 {
54  m_model = model;
55  m_containerIndex = containerIndex;
56  m_intensityDataItem = intensityItem;
57 }
QModelIndex m_containerIndex
Index of container with projections.

References m_containerIndex, m_intensityDataItem, and m_model.

Referenced by ProjectionsEditor::setContext().

◆ setSelectionModel()

void ProjectionsEditorActions::setSelectionModel ( QItemSelectionModel *  selectionModel)

Definition at line 59 of file ProjectionsEditorActions.cpp.

60 {
61  m_selectionModel = selectionModel;
62 }

References m_selectionModel.

Referenced by ProjectionsEditor::setContext().

◆ topToolbarActions()

QList< QAction * > ProjectionsEditorActions::topToolbarActions ( )

Definition at line 64 of file ProjectionsEditorActions.cpp.

65 {
66  return QList<QAction*>() << m_resetViewAction << m_togglePanelAction;
67 }

References m_resetViewAction, and m_togglePanelAction.

Referenced by ProjectionsEditor::topToolbarActions().

Member Data Documentation

◆ m_containerIndex

QModelIndex ProjectionsEditorActions::m_containerIndex
private

Index of container with projections.

Definition at line 55 of file ProjectionsEditorActions.h.

Referenced by setContext().

◆ m_deleteAction

QAction* ProjectionsEditorActions::m_deleteAction
private

Definition at line 53 of file ProjectionsEditorActions.h.

Referenced by ProjectionsEditorActions().

◆ m_intensityDataItem

IntensityDataItem* ProjectionsEditorActions::m_intensityDataItem
private

Definition at line 56 of file ProjectionsEditorActions.h.

Referenced by onSaveAction(), and setContext().

◆ m_model

SessionModel* ProjectionsEditorActions::m_model
private

Definition at line 54 of file ProjectionsEditorActions.h.

Referenced by onDeleteAction(), and setContext().

◆ m_parent

QWidget* ProjectionsEditorActions::m_parent
private

Definition at line 58 of file ProjectionsEditorActions.h.

Referenced by onSaveAction().

◆ m_resetViewAction

QAction* ProjectionsEditorActions::m_resetViewAction
private

Definition at line 51 of file ProjectionsEditorActions.h.

Referenced by ProjectionsEditorActions(), and topToolbarActions().

◆ m_selectionModel

QItemSelectionModel* ProjectionsEditorActions::m_selectionModel
private

Definition at line 57 of file ProjectionsEditorActions.h.

Referenced by onDeleteAction(), and setSelectionModel().

◆ m_togglePanelAction

QAction* ProjectionsEditorActions::m_togglePanelAction
private

Definition at line 52 of file ProjectionsEditorActions.h.

Referenced by ProjectionsEditorActions(), and topToolbarActions().


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