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

Description

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

Definition at line 26 of file MaskEditorToolbar.h.

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

Public Slots

void onChangeActivityRequest (MaskEditorFlags::Activity value)
 Handles ZOOM requests from MaskGraphicsView while user press and holds space bar. As soon as space bar is released, activity is returned to previous state. More...
 

Signals

void activityModeChanged (MaskEditorFlags::Activity)
 
void maskValueChanged (MaskEditorFlags::MaskValue)
 
void presentationTypeRequest (MaskEditorFlags::PresentationType)
 

Public Member Functions

 MaskEditorToolbar (MaskEditorActions *editorActions, QWidget *parent=nullptr)
 

Private Slots

void onActivityGroupChange (int value)
 
void onMaskValueGroupChange (int value)
 
void onPresentationTypePressed ()
 
void onPresentationTypeReleased ()
 

Private Member Functions

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

Private Attributes

QButtonGroup * m_activityButtonGroup
 
MaskEditorActionsm_editorActions
 
QButtonGroup * m_maskValueGroup
 
MaskEditorFlags::Activity m_previousActivity
 

Constructor & Destructor Documentation

◆ MaskEditorToolbar()

MaskEditorToolbar::MaskEditorToolbar ( MaskEditorActions editorActions,
QWidget *  parent = nullptr 
)

Definition at line 26 of file MaskEditorToolbar.cpp.

27  : QToolBar(parent)
28  , m_editorActions(editorActions)
29  , m_activityButtonGroup(new QButtonGroup(this))
30  , m_maskValueGroup(new QButtonGroup(this))
31 {
33  setProperty("_q_custom_style_disabled", QVariant(true));
34 
36  // setup_maskvalue_group();
40 
41 #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
42  connect(m_activityButtonGroup, &QButtonGroup::idClicked, this,
44  connect(m_maskValueGroup, &QButtonGroup::idClicked, this,
46 #else
47  connect(m_activityButtonGroup,
48  static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this,
50  connect(m_maskValueGroup,
51  static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this,
53 #endif
54 
56 }
QButtonGroup * m_activityButtonGroup
MaskEditorActions * m_editorActions
MaskEditorFlags::Activity currentActivity() const
MaskEditorFlags::Activity m_previousActivity
void onMaskValueGroupChange(int value)
void onActivityGroupChange(int value)
QButtonGroup * m_maskValueGroup
const int toolbar_icon_size

References currentActivity(), m_activityButtonGroup, m_maskValueGroup, m_previousActivity, onActivityGroupChange(), onMaskValueGroupChange(), setup_extratools_group(), setup_maskmodify_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 MaskEditorToolbar::activityModeChanged ( MaskEditorFlags::Activity  )
signal

◆ add_separator()

void MaskEditorToolbar::add_separator ( )
private

Definition at line 230 of file MaskEditorToolbar.cpp.

231 {
232  addWidget(new QLabel(" "));
233  addSeparator();
234  addWidget(new QLabel(" "));
235 }

Referenced by setup_extratools_group(), setup_maskmodify_group(), setup_selection_group(), and setup_shapes_group().

◆ currentActivity()

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

◆ maskValueChanged

void MaskEditorToolbar::maskValueChanged ( MaskEditorFlags::MaskValue  )
signal

◆ onActivityGroupChange

void MaskEditorToolbar::onActivityGroupChange ( int  value)
privateslot

Definition at line 71 of file MaskEditorToolbar.cpp.

72 {
73  Q_UNUSED(value);
75 }
void activityModeChanged(MaskEditorFlags::Activity)

References activityModeChanged(), and currentActivity().

Referenced by MaskEditorToolbar().

Here is the call graph for this function:

◆ onChangeActivityRequest

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

Handles ZOOM requests from MaskGraphicsView while user press and holds space bar. As soon as space bar is released, activity is returned to previous state.

Definition at line 60 of file MaskEditorToolbar.cpp.

61 {
62  if (value == MaskEditorFlags::PREVIOUS_MODE)
64  else {
66  setCurrentActivity(value);
67  }
69 }
void setCurrentActivity(MaskEditorFlags::Activity value)

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

Referenced by MaskEditor::setup_connections().

Here is the call graph for this function:

◆ onMaskValueGroupChange

void MaskEditorToolbar::onMaskValueGroupChange ( int  value)
privateslot

Definition at line 77 of file MaskEditorToolbar.cpp.

78 {
79  Q_UNUSED(value);
80  emit maskValueChanged(MaskEditorFlags::MaskValue(value));
81 }
void maskValueChanged(MaskEditorFlags::MaskValue)

References maskValueChanged().

Referenced by MaskEditorToolbar().

◆ onPresentationTypePressed

void MaskEditorToolbar::onPresentationTypePressed ( )
privateslot

Definition at line 83 of file MaskEditorToolbar.cpp.

84 {
86 }
void presentationTypeRequest(MaskEditorFlags::PresentationType)

References MaskEditorFlags::MASK_PRESENTER, and presentationTypeRequest().

Referenced by setup_extratools_group().

◆ onPresentationTypeReleased

void MaskEditorToolbar::onPresentationTypeReleased ( )
privateslot

◆ presentationTypeRequest

void MaskEditorToolbar::presentationTypeRequest ( MaskEditorFlags::PresentationType  )
signal

◆ setCurrentActivity()

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

Definition at line 242 of file MaskEditorToolbar.cpp.

243 {
244  m_activityButtonGroup->button(value)->setChecked(true);
245 }

References m_activityButtonGroup.

Referenced by onChangeActivityRequest().

◆ setup_extratools_group()

void MaskEditorToolbar::setup_extratools_group ( )
private

Definition at line 208 of file MaskEditorToolbar.cpp.

209 {
210  auto* presentationButton = new QToolButton(this);
211  presentationButton->setIcon(QIcon(":/Mask/images/maskeditor_lightbulb.svg"));
212  presentationButton->setToolTip("Press and hold to see mask results.");
213  addWidget(presentationButton);
214 
215  connect(presentationButton, &QToolButton::pressed, this,
217  connect(presentationButton, &QToolButton::released, this,
219 
220  auto* propertyPanelButton = new QToolButton(this);
221  propertyPanelButton->setIcon(QIcon(":/Mask/images/maskeditor_toolpanel.svg"));
222  propertyPanelButton->setToolTip("Open panel with additional properties");
223  addWidget(propertyPanelButton);
224 
225  connect(propertyPanelButton, &QToolButton::clicked, m_editorActions,
227  add_separator();
228 }
void propertyPanelRequest()

References add_separator(), m_editorActions, onPresentationTypePressed(), onPresentationTypeReleased(), and MaskEditorActions::propertyPanelRequest().

Referenced by MaskEditorToolbar().

Here is the call graph for this function:

◆ setup_maskmodify_group()

void MaskEditorToolbar::setup_maskmodify_group ( )
private

Definition at line 200 of file MaskEditorToolbar.cpp.

201 {
202  ASSERT(m_editorActions);
203  addAction(m_editorActions->bringToFrontAction());
204  addAction(m_editorActions->sendToBackAction());
205  add_separator();
206 }
QAction * bringToFrontAction()
QAction * sendToBackAction()

References add_separator(), MaskEditorActions::bringToFrontAction(), m_editorActions, and MaskEditorActions::sendToBackAction().

Referenced by MaskEditorToolbar().

Here is the call graph for this function:

◆ setup_maskvalue_group()

void MaskEditorToolbar::setup_maskvalue_group ( )
private

Definition at line 121 of file MaskEditorToolbar.cpp.

122 {
123  addWidget(new QLabel(" "));
124 
125  auto* maskTrueButton = new QRadioButton(this);
126  maskTrueButton->setText("masked");
127  maskTrueButton->setToolTip("Set mask to True (area is excluded from the simulation)");
128  maskTrueButton->setCheckable(true);
129  maskTrueButton->setChecked(true);
130  addWidget(maskTrueButton);
131 
132  addWidget(new QLabel(" "));
133 
134  auto* maskFalseButton = new QRadioButton(this);
135  maskFalseButton->setToolTip("Set mask to False (area stays in the simulation)");
136  maskFalseButton->setCheckable(true);
137  maskFalseButton->setText("active");
138  addWidget(maskFalseButton);
139 
140  m_maskValueGroup->addButton(maskTrueButton, MaskEditorFlags::MASK_ON);
141  m_maskValueGroup->addButton(maskFalseButton, MaskEditorFlags::MASK_OFF);
142 }

References m_maskValueGroup, MaskEditorFlags::MASK_OFF, and MaskEditorFlags::MASK_ON.

◆ setup_selection_group()

void MaskEditorToolbar::setup_selection_group ( )
private

Definition at line 93 of file MaskEditorToolbar.cpp.

94 {
95  auto* panButton = new QToolButton(this);
96  panButton->setIcon(QIcon(":/images/hand-right.svg"));
97  panButton->setToolTip("Pan/zoom mode (space)");
98  panButton->setCheckable(true);
99  panButton->setChecked(true);
100  addWidget(panButton);
101 
102  auto* resetViewButton = new QToolButton(this);
103  resetViewButton->setIcon(QIcon(":/images/camera-metering-center.svg"));
104  resetViewButton->setToolTip("Reset pan/zoom to initial state");
105  addWidget(resetViewButton);
106  connect(resetViewButton, &QToolButton::clicked, m_editorActions,
108 
109  add_separator();
110 
111  auto* selectionButton = new QToolButton(this);
112  selectionButton->setIcon(QIcon(":/Mask/images/maskeditor_arrow.svg"));
113  selectionButton->setToolTip("Select/modify mask");
114  selectionButton->setCheckable(true);
115  addWidget(selectionButton);
116 
118  m_activityButtonGroup->addButton(selectionButton, MaskEditorFlags::SELECTION_MODE);
119 }

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

Referenced by MaskEditorToolbar().

Here is the call graph for this function:

◆ setup_shapes_group()

void MaskEditorToolbar::setup_shapes_group ( )
private

Definition at line 144 of file MaskEditorToolbar.cpp.

145 {
146  auto* roiButton = new QToolButton(this);
147  roiButton->setIcon(QIcon(":/Mask/images/maskeditor_roi.svg"));
148  roiButton->setToolTip("Create region of interest");
149  roiButton->setCheckable(true);
150  addWidget(roiButton);
151 
152  auto* rectangleButton = new QToolButton(this);
153  rectangleButton->setIcon(QIcon(":/Mask/images/maskeditor_rectangle.svg"));
154  rectangleButton->setToolTip("Create rectangle mask");
155  rectangleButton->setCheckable(true);
156  addWidget(rectangleButton);
157 
158  auto* polygonButton = new QToolButton(this);
159  polygonButton->setIcon(QIcon(":/Mask/images/maskeditor_polygon.svg"));
160  polygonButton->setToolTip("Create polygon mask");
161  polygonButton->setCheckable(true);
162  addWidget(polygonButton);
163 
164  auto* verticalLineButton = new QToolButton(this);
165  verticalLineButton->setIcon(QIcon(":/Mask/images/maskeditor_verticalline.svg"));
166  verticalLineButton->setToolTip("Create vertical line mask");
167  verticalLineButton->setCheckable(true);
168  addWidget(verticalLineButton);
169 
170  auto* horizontalLineButton = new QToolButton(this);
171  horizontalLineButton->setIcon(QIcon(":/Mask/images/maskeditor_horizontalline.svg"));
172  horizontalLineButton->setToolTip("Create horizontal line mask");
173  horizontalLineButton->setCheckable(true);
174  addWidget(horizontalLineButton);
175 
176  auto* ellipseButton = new QToolButton(this);
177  ellipseButton->setIcon(QIcon(":/Mask/images/maskeditor_ellipse.svg"));
178  ellipseButton->setToolTip("Create ellipse mask");
179  ellipseButton->setCheckable(true);
180  addWidget(ellipseButton);
181 
182  // QToolButton *maskAllButton = new QToolButton(this);
183  // maskAllButton->setIcon(QIcon(":/Mask/images/maskeditor_maskall.svg"));
184  // maskAllButton->setToolTip("Create masked area covering whole detector plane\n"
185  // "Will be placed beneath all masks. Only one instance is
186  // allowed.");
187  // maskAllButton->setCheckable(true);
188  // addWidget(maskAllButton);
189 
190  m_activityButtonGroup->addButton(roiButton, MaskEditorFlags::ROI_MODE);
191  m_activityButtonGroup->addButton(rectangleButton, MaskEditorFlags::RECTANGLE_MODE);
192  m_activityButtonGroup->addButton(polygonButton, MaskEditorFlags::POLYGON_MODE);
193  m_activityButtonGroup->addButton(verticalLineButton, MaskEditorFlags::VERTICAL_LINE_MODE);
194  m_activityButtonGroup->addButton(horizontalLineButton, MaskEditorFlags::HORIZONTAL_LINE_MODE);
195  m_activityButtonGroup->addButton(ellipseButton, MaskEditorFlags::ELLIPSE_MODE);
196  // m_activityButtonGroup->addButton(maskAllButton, MaskEditorFlags::MASKALL_MODE);
197  add_separator();
198 }

References add_separator(), MaskEditorFlags::ELLIPSE_MODE, MaskEditorFlags::HORIZONTAL_LINE_MODE, m_activityButtonGroup, MaskEditorFlags::POLYGON_MODE, MaskEditorFlags::RECTANGLE_MODE, MaskEditorFlags::ROI_MODE, and MaskEditorFlags::VERTICAL_LINE_MODE.

Referenced by MaskEditorToolbar().

Here is the call graph for this function:

Member Data Documentation

◆ m_activityButtonGroup

QButtonGroup* MaskEditorToolbar::m_activityButtonGroup
private

◆ m_editorActions

MaskEditorActions* MaskEditorToolbar::m_editorActions
private

◆ m_maskValueGroup

QButtonGroup* MaskEditorToolbar::m_maskValueGroup
private

Definition at line 58 of file MaskEditorToolbar.h.

Referenced by MaskEditorToolbar(), and setup_maskvalue_group().

◆ m_previousActivity

MaskEditorFlags::Activity MaskEditorToolbar::m_previousActivity
private

Definition at line 59 of file MaskEditorToolbar.h.

Referenced by MaskEditorToolbar(), and onChangeActivityRequest().


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