Skip to content
Snippets Groups Projects
Commit bedd6d0c authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

[j.0] restore functionality of "lightbulb" button: display masked pixels...

[j.0] restore functionality of "lightbulb" button: display masked pixels instead of geometric representation ()

Merging branch 'j.0'  into 'main'.

See merge request !2625
parents 99131c9b ce1ba1f0
No related branches found
No related tags found
1 merge request!2625restore functionality of "lightbulb" button: display masked pixels instead of geometric representation
Pipeline #148204 passed
...@@ -128,7 +128,7 @@ void MaskEditorCanvas::updateCanvas(Data2DItem* data_item) ...@@ -128,7 +128,7 @@ void MaskEditorCanvas::updateCanvas(Data2DItem* data_item)
m_scene->onActivityChanged(m_current_activity); // TODO call no longer needed ? m_scene->onActivityChanged(m_current_activity); // TODO call no longer needed ?
} }
void MaskEditorCanvas::onPresentationChange(bool pixelized) void MaskEditorCanvas::changeMaskDisplay(bool pixelized)
{ {
m_scene->clearSelection(); // important to avoid crash (unsubscribe while calling subscribers) m_scene->clearSelection(); // important to avoid crash (unsubscribe while calling subscribers)
......
...@@ -47,7 +47,7 @@ signals: ...@@ -47,7 +47,7 @@ signals:
public slots: public slots:
void onResetViewRequest(); void onResetViewRequest();
void exportPlot() const; void exportPlot() const;
void onPresentationChange(bool pixelized); void changeMaskDisplay(bool pixelized);
void setCanvasMode(Canvas2DMode::Flag mode); void setCanvasMode(Canvas2DMode::Flag mode);
private slots: private slots:
......
...@@ -90,6 +90,9 @@ Plot2DFrame::Plot2DFrame(std::unique_ptr<DataSource>&& data_source) ...@@ -90,6 +90,9 @@ Plot2DFrame::Plot2DFrame(std::unique_ptr<DataSource>&& data_source)
connect(toolbar, &Data2DToolbar::activityChanged, m_canvas1D, connect(toolbar, &Data2DToolbar::activityChanged, m_canvas1D,
&ProjectedGraphsCanvas::onActivityChanged); &ProjectedGraphsCanvas::onActivityChanged);
connect(toolbar, &Data2DToolbar::requestMaskDisplay, m_canvas2D,
&MaskEditorCanvas::changeMaskDisplay);
connect(m_canvas2D, &MaskEditorCanvas::changeActivityRequest, toolbar, connect(m_canvas2D, &MaskEditorCanvas::changeActivityRequest, toolbar,
&Data2DToolbar::onChangeActivityRequest); &Data2DToolbar::onChangeActivityRequest);
......
...@@ -30,106 +30,106 @@ Data2DToolbar::Data2DToolbar() ...@@ -30,106 +30,106 @@ Data2DToolbar::Data2DToolbar()
//... Frame tools //... Frame tools
auto* propertyPanelButton = new QToolButton; auto* propertyPanel_button = new QToolButton;
propertyPanelButton->setDefaultAction(actions()->toggle_properties_panel); propertyPanel_button->setDefaultAction(actions()->toggle_properties_panel);
addWidget(propertyPanelButton); addWidget(propertyPanel_button);
addSeparator(); addSeparator();
//... Selection / zoom mode //... Selection / zoom mode
auto* selectionButton = new QToolButton; auto* selection_button = new QToolButton;
selectionButton->setIcon(QIcon(":/images/mask/arrow.svg")); selection_button->setIcon(QIcon(":/images/mask/arrow.svg"));
selectionButton->setToolTip("Select/modify mask"); selection_button->setToolTip("Select/modify mask");
selectionButton->setCheckable(true); selection_button->setCheckable(true);
selectionButton->setChecked(true); selection_button->setChecked(true);
addWidget(selectionButton); addWidget(selection_button);
m_activity_button_group->addButton(selectionButton, Canvas2DMode::SELECTION); m_activity_button_group->addButton(selection_button, Canvas2DMode::SELECTION);
auto* panButton = new QToolButton; auto* pan_button = new QToolButton;
panButton->setIcon(QIcon(":/images/hand-right.svg")); pan_button->setIcon(QIcon(":/images/hand-right.svg"));
panButton->setToolTip("Pan/zoom mode (space)\n" pan_button->setToolTip("Pan/zoom mode (space)\n"
"Drag axes with the mouse, use mouse wheel to zoom in/out"); "Drag axes with the mouse, use mouse wheel to zoom in/out");
panButton->setCheckable(true); pan_button->setCheckable(true);
addWidget(panButton); addWidget(pan_button);
m_activity_button_group->addButton(panButton, Canvas2DMode::PAN_ZOOM); m_activity_button_group->addButton(pan_button, Canvas2DMode::PAN_ZOOM);
auto* resetViewButton = new QToolButton; auto* resetView_button = new QToolButton;
resetViewButton->setDefaultAction(actions()->reset_view); resetView_button->setDefaultAction(actions()->reset_view);
addWidget(resetViewButton); addWidget(resetView_button);
addSeparator(); addSeparator();
//... Projection tools //... Projection tools
auto* horizontalPrjnButton = new QToolButton; auto* horizontal_prjn_button = new QToolButton;
horizontalPrjnButton->setIcon(QIcon(":/images/mask/horizontalline.svg")); horizontal_prjn_button->setIcon(QIcon(":/images/mask/horizontalline.svg"));
horizontalPrjnButton->setToolTip("Create horizontal projection"); horizontal_prjn_button->setToolTip("Create horizontal projection");
horizontalPrjnButton->setCheckable(true); horizontal_prjn_button->setCheckable(true);
m_activity_button_group->addButton(horizontalPrjnButton, Canvas2DMode::HORIZONTAL_PRJN); m_activity_button_group->addButton(horizontal_prjn_button, Canvas2DMode::HORIZONTAL_PRJN);
addWidget(horizontalPrjnButton); addWidget(horizontal_prjn_button);
auto* verticalPrjnButton = new QToolButton; auto* vertical_prjn_button = new QToolButton;
verticalPrjnButton->setIcon(QIcon(":/images/mask/verticalline.svg")); vertical_prjn_button->setIcon(QIcon(":/images/mask/verticalline.svg"));
verticalPrjnButton->setToolTip("Create vertical projection"); vertical_prjn_button->setToolTip("Create vertical projection");
verticalPrjnButton->setCheckable(true); vertical_prjn_button->setCheckable(true);
m_activity_button_group->addButton(verticalPrjnButton, Canvas2DMode::VERTICAL_PRJN); m_activity_button_group->addButton(vertical_prjn_button, Canvas2DMode::VERTICAL_PRJN);
addWidget(verticalPrjnButton); addWidget(vertical_prjn_button);
addSeparator(); addSeparator();
//... Shape creation tools //... Shape creation tools
auto* roiButton = new QToolButton; auto* roi_button = new QToolButton;
roiButton->setIcon(QIcon(":/images/mask/roi.svg")); roi_button->setIcon(QIcon(":/images/mask/roi.svg"));
roiButton->setToolTip("Create region of interest"); roi_button->setToolTip("Create region of interest");
roiButton->setCheckable(true); roi_button->setCheckable(true);
m_activity_button_group->addButton(roiButton, Canvas2DMode::ROI); m_activity_button_group->addButton(roi_button, Canvas2DMode::ROI);
addWidget(roiButton); addWidget(roi_button);
// auto* maskAllButton = new QToolButton; // auto* maskAll_button = new QToolButton;
// maskAllButton->setIcon(QIcon(":/images/mask/maskall.svg")); // maskAll_button->setIcon(QIcon(":/images/mask/maskall.svg"));
// maskAllButton->setToolTip("Create masked area covering whole detector plane\n" // maskAll_button->setToolTip("Create masked area covering whole detector plane\n"
// "Will be placed beneath all masks. Only one instance is // "Will be placed beneath all masks. Only one instance is
// allowed."); // allowed.");
// maskAllButton->setCheckable(true); // maskAll_button->setCheckable(true);
// m_activity_button_group->addButton(maskAllButton, Canvas2DMode::MASKALL); // m_activity_button_group->addButton(maskAll_button, Canvas2DMode::MASKALL);
// addWidget(maskAllButton); // addWidget(maskAll_button);
auto* rectangleButton = new QToolButton; auto* rectangle_button = new QToolButton;
rectangleButton->setIcon(QIcon(":/images/mask/rectangle.svg")); rectangle_button->setIcon(QIcon(":/images/mask/rectangle.svg"));
rectangleButton->setToolTip("Create rectangle mask"); rectangle_button->setToolTip("Create rectangle mask");
rectangleButton->setCheckable(true); rectangle_button->setCheckable(true);
m_activity_button_group->addButton(rectangleButton, Canvas2DMode::RECTANGLE); m_activity_button_group->addButton(rectangle_button, Canvas2DMode::RECTANGLE);
addWidget(rectangleButton); addWidget(rectangle_button);
auto* polygonButton = new QToolButton; auto* polygon_button = new QToolButton;
polygonButton->setIcon(QIcon(":/images/mask/polygon.svg")); polygon_button->setIcon(QIcon(":/images/mask/polygon.svg"));
polygonButton->setToolTip("Create polygon mask"); polygon_button->setToolTip("Create polygon mask");
m_activity_button_group->addButton(polygonButton, Canvas2DMode::POLYGON); m_activity_button_group->addButton(polygon_button, Canvas2DMode::POLYGON);
polygonButton->setCheckable(true); polygon_button->setCheckable(true);
addWidget(polygonButton); addWidget(polygon_button);
auto* ellipseButton = new QToolButton; auto* ellipse_button = new QToolButton;
ellipseButton->setIcon(QIcon(":/images/mask/ellipse.svg")); ellipse_button->setIcon(QIcon(":/images/mask/ellipse.svg"));
ellipseButton->setToolTip("Create ellipse mask"); ellipse_button->setToolTip("Create ellipse mask");
ellipseButton->setCheckable(true); ellipse_button->setCheckable(true);
m_activity_button_group->addButton(ellipseButton, Canvas2DMode::ELLIPSE); m_activity_button_group->addButton(ellipse_button, Canvas2DMode::ELLIPSE);
addWidget(ellipseButton); addWidget(ellipse_button);
auto* horizontalMaskButton = new QToolButton; auto* horizontal_mask_button = new QToolButton;
horizontalMaskButton->setIcon(QIcon(":/images/mask/horizontalline.svg")); horizontal_mask_button->setIcon(QIcon(":/images/mask/horizontalline.svg"));
horizontalMaskButton->setToolTip("Create horizontal line mask"); horizontal_mask_button->setToolTip("Create horizontal line mask");
horizontalMaskButton->setCheckable(true); horizontal_mask_button->setCheckable(true);
m_activity_button_group->addButton(horizontalMaskButton, Canvas2DMode::HORIZONTAL_MASK); m_activity_button_group->addButton(horizontal_mask_button, Canvas2DMode::HORIZONTAL_MASK);
addWidget(horizontalMaskButton); addWidget(horizontal_mask_button);
auto* verticalMaskButton = new QToolButton; auto* vertical_mask_button = new QToolButton;
verticalMaskButton->setIcon(QIcon(":/images/mask/verticalline.svg")); vertical_mask_button->setIcon(QIcon(":/images/mask/verticalline.svg"));
verticalMaskButton->setToolTip("Create vertical line mask"); vertical_mask_button->setToolTip("Create vertical line mask");
verticalMaskButton->setCheckable(true); vertical_mask_button->setCheckable(true);
m_activity_button_group->addButton(verticalMaskButton, Canvas2DMode::VERTICAL_MASK); m_activity_button_group->addButton(vertical_mask_button, Canvas2DMode::VERTICAL_MASK);
addWidget(verticalMaskButton); addWidget(vertical_mask_button);
connect(m_activity_button_group, &QButtonGroup::idClicked, connect(m_activity_button_group, &QButtonGroup::idClicked,
[this] { emit activityChanged(currentActivity()); }); [this] { emit activityChanged(currentActivity()); });
...@@ -138,33 +138,34 @@ Data2DToolbar::Data2DToolbar() ...@@ -138,33 +138,34 @@ Data2DToolbar::Data2DToolbar()
//... Modifier and inspector tools //... Modifier and inspector tools
auto* raiseButton = new QToolButton; auto* raise_button = new QToolButton;
addWidget(raiseButton); addWidget(raise_button);
raiseButton->setDefaultAction(actions()->raise_mask); raise_button->setDefaultAction(actions()->raise_mask);
auto* lowerButton = new QToolButton; auto* lower_button = new QToolButton;
addWidget(lowerButton); addWidget(lower_button);
lowerButton->setDefaultAction(actions()->lower_mask); lower_button->setDefaultAction(actions()->lower_mask);
addSeparator(); addSeparator();
auto* presentationButton = new QToolButton; auto* mask_display_button = new QToolButton;
presentationButton->setIcon(QIcon(":/images/mask/lightbulb.svg")); mask_display_button->setIcon(QIcon(":/images/mask/lightbulb.svg"));
presentationButton->setToolTip("Press and hold to see mask results."); mask_display_button->setToolTip("Press and hold to see mask results.");
addWidget(presentationButton); addWidget(mask_display_button);
connect(presentationButton, &QToolButton::pressed, [this] { emit presentationChange(true); }); connect(mask_display_button, &QToolButton::pressed, [this] { emit requestMaskDisplay(true); });
connect(presentationButton, &QToolButton::released, [this] { emit presentationChange(false); }); connect(mask_display_button, &QToolButton::released,
[this] { emit requestMaskDisplay(false); });
addSeparator(); addSeparator();
auto* plot2DButton = new QToolButton; auto* plot2D_button = new QToolButton;
plot2DButton->setDefaultAction(actions()->save_plot); plot2D_button->setDefaultAction(actions()->save_plot);
addWidget(plot2DButton); addWidget(plot2D_button);
auto* saveButton = new QToolButton; auto* save_button = new QToolButton;
saveButton->setDefaultAction(actions()->save_projections); save_button->setDefaultAction(actions()->save_projections);
addWidget(saveButton); addWidget(save_button);
} }
void Data2DToolbar::onChangeActivityRequest(Canvas2DMode::Flag mode) void Data2DToolbar::onChangeActivityRequest(Canvas2DMode::Flag mode)
......
...@@ -34,7 +34,7 @@ public slots: ...@@ -34,7 +34,7 @@ public slots:
signals: signals:
void activityChanged(Canvas2DMode::Flag); void activityChanged(Canvas2DMode::Flag);
void presentationChange(bool); void requestMaskDisplay(bool);
private: private:
Canvas2DMode::Flag currentActivity() const; Canvas2DMode::Flag currentActivity() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment