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

Description

Toolbar with projections buttons (horizontal projections, vertical projections, select, zoom) located at the right-hand side of ProjectionsEditor (part of JobProjectionsWidget).

Definition at line 27 of file ProjectionsToolbar.h.

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

Public Slots

void onChangeActivityRequest (MaskEditorFlags::Activity value)
 
void onProjectionTabChange (MaskEditorFlags::Activity value)
 Change activity only if current activity is one of drawing mode (horizontal, vertical projections drawing). More...
 

Signals

void activityModeChanged (MaskEditorFlags::Activity)
 

Public Member Functions

 ProjectionsToolbar (ProjectionsEditorActions *editorActions, QWidget *parent=nullptr)
 

Private Slots

void onActivityGroupChange (int)
 

Private Member Functions

void add_separator ()
 
MaskEditorFlags::Activity currentActivity () const
 
void setCurrentActivity (MaskEditorFlags::Activity value)
 
void setup_extratools_group ()
 
void setup_selection_group ()
 
void setup_shapes_group ()
 

Private Attributes

QButtonGroup * m_activityButtonGroup
 
ProjectionsEditorActionsm_editorActions
 
MaskEditorFlags::Activity m_previousActivity
 

Constructor & Destructor Documentation

◆ ProjectionsToolbar()

ProjectionsToolbar::ProjectionsToolbar ( ProjectionsEditorActions editorActions,
QWidget *  parent = nullptr 
)

Definition at line 40 of file ProjectionsToolbar.cpp.

41  : QToolBar(parent)
42  , m_editorActions(editorActions)
43  , m_activityButtonGroup(new QButtonGroup(this))
44 {
46  setProperty("_q_custom_style_disabled", QVariant(true));
47 
51 
52 #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
53  connect(m_activityButtonGroup, &QButtonGroup::idClicked, this,
55 #else
56  connect(m_activityButtonGroup,
57  static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this,
59 #endif
60 
62 }
ProjectionsEditorActions * m_editorActions
MaskEditorFlags::Activity currentActivity() const
QButtonGroup * m_activityButtonGroup
MaskEditorFlags::Activity m_previousActivity
const int toolbar_icon_size

References currentActivity(), m_activityButtonGroup, m_previousActivity, onActivityGroupChange(), setup_extratools_group(), setup_selection_group(), setup_shapes_group(), and GUI::Constants::toolbar_icon_size.

Here is the call graph for this function:

Member Function Documentation

◆ activityModeChanged

void ProjectionsToolbar::activityModeChanged ( MaskEditorFlags::Activity  )
signal

◆ add_separator()

void ProjectionsToolbar::add_separator ( )
private

Definition at line 147 of file ProjectionsToolbar.cpp.

148 {
149  addWidget(new QLabel(" "));
150  addSeparator();
151  addWidget(new QLabel(" "));
152 }

Referenced by setup_selection_group(), and setup_shapes_group().

◆ currentActivity()

MaskEditorFlags::Activity ProjectionsToolbar::currentActivity ( ) const
private

◆ onActivityGroupChange

void ProjectionsToolbar::onActivityGroupChange ( int  )
privateslot

Definition at line 84 of file ProjectionsToolbar.cpp.

85 {
87 }
void activityModeChanged(MaskEditorFlags::Activity)

References activityModeChanged(), and currentActivity().

Referenced by ProjectionsToolbar().

Here is the call graph for this function:

◆ onChangeActivityRequest

void ProjectionsToolbar::onChangeActivityRequest ( MaskEditorFlags::Activity  value)
slot

Definition at line 64 of file ProjectionsToolbar.cpp.

65 {
66  if (value == MaskEditorFlags::PREVIOUS_MODE)
68  else {
70  setCurrentActivity(value);
71  }
73 }
void setCurrentActivity(MaskEditorFlags::Activity value)

References activityModeChanged(), currentActivity(), m_previousActivity, MaskEditorFlags::PREVIOUS_MODE, and setCurrentActivity().

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

Here is the call graph for this function:

◆ onProjectionTabChange

void ProjectionsToolbar::onProjectionTabChange ( MaskEditorFlags::Activity  value)
slot

Change activity only if current activity is one of drawing mode (horizontal, vertical projections drawing).

Definition at line 77 of file ProjectionsToolbar.cpp.

References currentActivity(), MaskEditorFlags::HORIZONTAL_LINE_MODE, onChangeActivityRequest(), and MaskEditorFlags::VERTICAL_LINE_MODE.

Referenced by ProjectionsEditor::setup_connections().

Here is the call graph for this function:

◆ setCurrentActivity()

void ProjectionsToolbar::setCurrentActivity ( MaskEditorFlags::Activity  value)
private

Definition at line 159 of file ProjectionsToolbar.cpp.

160 {
161  int button_index = static_cast<int>(value);
162  m_activityButtonGroup->button(button_index)->setChecked(true);
163 }

References m_activityButtonGroup.

Referenced by onChangeActivityRequest().

◆ setup_extratools_group()

void ProjectionsToolbar::setup_extratools_group ( )
private

Definition at line 137 of file ProjectionsToolbar.cpp.

138 {
139  auto* saveButton = new QToolButton(this);
140  saveButton->setIcon(QIcon(":/Mask/images/maskeditor_save.svg"));
141  saveButton->setToolTip("Save created projections in multi-column ASCII file.");
142  addWidget(saveButton);
143  connect(saveButton, &QToolButton::clicked, m_editorActions,
145 }
void onSaveAction()
Performs saving of projections in ascii file.

References m_editorActions, and ProjectionsEditorActions::onSaveAction().

Referenced by ProjectionsToolbar().

Here is the call graph for this function:

◆ setup_selection_group()

void ProjectionsToolbar::setup_selection_group ( )
private

Definition at line 89 of file ProjectionsToolbar.cpp.

90 {
91  auto* panButton = new QToolButton(this);
92  panButton->setIcon(QIcon(":/images/hand-right.svg"));
93  panButton->setToolTip(pan_zoom_tooltip);
94  panButton->setCheckable(true);
95  panButton->setChecked(true);
96  addWidget(panButton);
97 
98  auto* resetViewButton = new QToolButton(this);
99  resetViewButton->setIcon(QIcon(":/images/camera-metering-center.svg"));
100  resetViewButton->setToolTip(reset_view_tooltip);
101  addWidget(resetViewButton);
102  connect(resetViewButton, &QToolButton::clicked, m_editorActions,
104 
105  add_separator();
106 
107  auto* selectionButton = new QToolButton(this);
108  selectionButton->setIcon(QIcon(":/Mask/images/maskeditor_arrow.svg"));
109  selectionButton->setToolTip(selection_mode_tooltip);
110  selectionButton->setCheckable(true);
111  addWidget(selectionButton);
112 
114  m_activityButtonGroup->addButton(selectionButton, MaskEditorFlags::SELECTION_MODE);
115 }

References add_separator(), m_activityButtonGroup, m_editorActions, MaskEditorFlags::PAN_ZOOM_MODE, ProjectionsEditorActions::resetViewRequest(), and MaskEditorFlags::SELECTION_MODE.

Referenced by ProjectionsToolbar().

Here is the call graph for this function:

◆ setup_shapes_group()

void ProjectionsToolbar::setup_shapes_group ( )
private

Definition at line 117 of file ProjectionsToolbar.cpp.

118 {
119  auto* horizontalLineButton = new QToolButton(this);
120  horizontalLineButton->setIcon(QIcon(":/Mask/images/maskeditor_horizontalline.svg"));
121  horizontalLineButton->setToolTip(horizontal_mode_tooltip);
122  horizontalLineButton->setCheckable(true);
123  addWidget(horizontalLineButton);
124 
125  auto* verticalLineButton = new QToolButton(this);
126  verticalLineButton->setIcon(QIcon(":/Mask/images/maskeditor_verticalline.svg"));
127  verticalLineButton->setToolTip(vertical_mode_tooltip);
128  verticalLineButton->setCheckable(true);
129  addWidget(verticalLineButton);
130 
131  m_activityButtonGroup->addButton(verticalLineButton, MaskEditorFlags::VERTICAL_LINE_MODE);
132  m_activityButtonGroup->addButton(horizontalLineButton, MaskEditorFlags::HORIZONTAL_LINE_MODE);
133 
134  add_separator();
135 }

References add_separator(), MaskEditorFlags::HORIZONTAL_LINE_MODE, m_activityButtonGroup, and MaskEditorFlags::VERTICAL_LINE_MODE.

Referenced by ProjectionsToolbar().

Here is the call graph for this function:

Member Data Documentation

◆ m_activityButtonGroup

QButtonGroup* ProjectionsToolbar::m_activityButtonGroup
private

◆ m_editorActions

ProjectionsEditorActions* ProjectionsToolbar::m_editorActions
private

Definition at line 51 of file ProjectionsToolbar.h.

Referenced by setup_extratools_group(), and setup_selection_group().

◆ m_previousActivity

MaskEditorFlags::Activity ProjectionsToolbar::m_previousActivity
private

Definition at line 53 of file ProjectionsToolbar.h.

Referenced by ProjectionsToolbar(), and onChangeActivityRequest().


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