From 3f260a04f36153c3d85aaa9b4bb88726eb4cfd18 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 28 Dec 2023 13:15:26 +0100 Subject: [PATCH 01/28] MaskGraphicsProxy c'tor: rm pointless initialization --- GUI/View/Scene/MaskGraphicsProxy.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/GUI/View/Scene/MaskGraphicsProxy.cpp b/GUI/View/Scene/MaskGraphicsProxy.cpp index b39b124e5e0..bcefac85ae1 100644 --- a/GUI/View/Scene/MaskGraphicsProxy.cpp +++ b/GUI/View/Scene/MaskGraphicsProxy.cpp @@ -16,7 +16,6 @@ #include <QGraphicsSceneMouseEvent> MaskGraphicsProxy::MaskGraphicsProxy() - : m_zooming(false) { resize(1200, 1000); setZooming(true); -- GitLab From 82233cb6e8dce7b87a28b34bfed63ef500ec12e5 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 28 Dec 2023 13:13:57 +0100 Subject: [PATCH 02/28] MaskGraphicsProxy c'tor: rm resize --- GUI/View/Scene/MaskGraphicsProxy.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/GUI/View/Scene/MaskGraphicsProxy.cpp b/GUI/View/Scene/MaskGraphicsProxy.cpp index bcefac85ae1..e00d3053e9d 100644 --- a/GUI/View/Scene/MaskGraphicsProxy.cpp +++ b/GUI/View/Scene/MaskGraphicsProxy.cpp @@ -17,7 +17,6 @@ MaskGraphicsProxy::MaskGraphicsProxy() { - resize(1200, 1000); setZooming(true); } -- GitLab From c246eedff1a1a5a9f8eb8bcebf7bc3595d52ae9a Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 28 Dec 2023 09:57:10 +0100 Subject: [PATCH 03/28] MaskEditingFrame rm setSizePolicy, had no effect --- GUI/View/Frame/MaskEditingFrame.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/GUI/View/Frame/MaskEditingFrame.cpp b/GUI/View/Frame/MaskEditingFrame.cpp index 045b9191b5a..976c43c2416 100644 --- a/GUI/View/Frame/MaskEditingFrame.cpp +++ b/GUI/View/Frame/MaskEditingFrame.cpp @@ -30,8 +30,6 @@ MaskEditingFrame::MaskEditingFrame(QWidget* parent) , m_panel(new MaskPanel) , m_canvas(new MaskEditorCanvas) { - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - auto* layout = new QHBoxLayout; setLayout(layout); layout->setContentsMargins(0, 0, 0, 0); -- GitLab From cda6270a9149b7705b756d574d888af04ce4a5fc Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 13:39:05 +0100 Subject: [PATCH 04/28] disambiguate onActivityChanged -> setProjectionsCanvasMode --- GUI/View/Canvas/MaskEditorCanvas.cpp | 6 ++++++ GUI/View/Canvas/ProjectionsEditorCanvas.cpp | 9 ++++++++- GUI/View/Canvas/ProjectionsEditorCanvas.h | 2 +- GUI/View/Frame/Plot2DWithProjectionFrame.cpp | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/GUI/View/Canvas/MaskEditorCanvas.cpp b/GUI/View/Canvas/MaskEditorCanvas.cpp index 6ab228199c8..cb080d8e380 100644 --- a/GUI/View/Canvas/MaskEditorCanvas.cpp +++ b/GUI/View/Canvas/MaskEditorCanvas.cpp @@ -24,6 +24,7 @@ #include "GUI/View/Scene/MaskGraphicsScene.h" #include "GUI/View/Scene/MaskGraphicsView.h" #include <QVBoxLayout> +#include <iostream> MaskEditorCanvas::MaskEditorCanvas(QWidget* parent) : QWidget(parent) @@ -51,6 +52,7 @@ MaskEditorCanvas::~MaskEditorCanvas() = default; void MaskEditorCanvas::updateMaskCanvas(Data2DItem* data2DItem, QItemSelectionModel* selModel) { + std::cout<<"DEBG MaskEditorCanvas::updateMaskCanvas"<<std::endl; m_data2DItem = data2DItem; repaintScene(); @@ -61,6 +63,7 @@ void MaskEditorCanvas::updateMaskCanvas(Data2DItem* data2DItem, QItemSelectionMo void MaskEditorCanvas::resetMaskCanvas() { + std::cout<<"DEBG MaskEditorCanvas::resetMaskCanvas"<<std::endl; m_data2DItem = nullptr; m_scene->dissociateItems(); m_statusLabel->reset(); @@ -68,6 +71,7 @@ void MaskEditorCanvas::resetMaskCanvas() void MaskEditorCanvas::onPresentationChange(bool pixelized) { + std::cout<<"DEBG MaskEditorCanvas::onPresentationChange("<<std::endl; m_scene->clearSelection(); // important to avoid crash (unsubscribe while calling subscribers) ASSERT(m_data2DItem); @@ -99,6 +103,7 @@ void MaskEditorCanvas::onPresentationChange(bool pixelized) void MaskEditorCanvas::repaintScene() { + std::cout<<"DEBG MaskEditorCanvas::repaintScene"<<std::endl; m_scene->updateSize(m_view->size()); // TODO replace by proper repaint command } @@ -113,6 +118,7 @@ void MaskEditorCanvas::onSavePlotRequest() void MaskEditorCanvas::onResetViewRequest() { + std::cout<<"DEBG MaskEditorCanvas::onResetViewRequest"<<std::endl; m_view->onResetViewRequest(); if (m_data2DItem->isZoomed()) diff --git a/GUI/View/Canvas/ProjectionsEditorCanvas.cpp b/GUI/View/Canvas/ProjectionsEditorCanvas.cpp index 7bfb552e4e2..b9a0d54a68c 100644 --- a/GUI/View/Canvas/ProjectionsEditorCanvas.cpp +++ b/GUI/View/Canvas/ProjectionsEditorCanvas.cpp @@ -25,6 +25,7 @@ #include "GUI/View/Scene/MaskGraphicsView.h" #include <QItemSelectionModel> #include <QVBoxLayout> +#include <iostream> ProjectionsEditorCanvas::ProjectionsEditorCanvas(QWidget* parent) : QWidget(parent) @@ -55,6 +56,7 @@ ProjectionsEditorCanvas::~ProjectionsEditorCanvas() = default; void ProjectionsEditorCanvas::updateProjsCanvas(Data2DItem* data2DItem) { + std::cout<<"DEBG ProjectionsEditorCanvas::updateProjsCanvas"<<std::endl; MaskeditorListmodel* mask_list_model = data2DItem->getOrCreateProjectionModel(); ASSERT(mask_list_model); @@ -80,6 +82,7 @@ void ProjectionsEditorCanvas::updateProjsCanvas(Data2DItem* data2DItem) void ProjectionsEditorCanvas::resetProjsCanvas() { + std::cout<<"DEBG ProjectionsEditorCanvas::resetProjsCanvas"<<std::endl; setConnected(false); m_data2DItem = nullptr; m_colorMap = nullptr; @@ -88,6 +91,7 @@ void ProjectionsEditorCanvas::resetProjsCanvas() void ProjectionsEditorCanvas::onEnteringColorMap() { + std::cout<<"DEBG ProjectionsEditorCanvas::onEnteringColorMap"<<std::endl; if (m_liveProjection || m_block_update) return; @@ -143,13 +147,15 @@ void ProjectionsEditorCanvas::onPositionChanged(double x, double y) void ProjectionsEditorCanvas::onResetViewRequest() { + std::cout<<"DEBG ProjectionsEditorCanvas::onResetViewRequest"<<std::endl; m_view->onResetViewRequest(); m_data2DItem->resetView(); gDoc->setModified(); } -void ProjectionsEditorCanvas::onActivityChanged(MaskFlags::MaskMode mask_mode) +void ProjectionsEditorCanvas::setProjectionsCanvasMode(MaskFlags::MaskMode mask_mode) { + std::cout<<"DEBG ProjectionsEditorCanvas::setProjectionsCanvasMode"<<std::endl; m_currentActivity = mask_mode; m_scene->onActivityChanged(mask_mode); onLeavingColorMap(); @@ -167,6 +173,7 @@ void ProjectionsEditorCanvas::onLineItemMoved(LineItem* sender) void ProjectionsEditorCanvas::setColorMap(ColorMap* colorMap) { + std::cout<<"DEBG ProjectionsEditorCanvas::setColorMap"<<std::endl; ASSERT(colorMap); m_colorMap = colorMap; diff --git a/GUI/View/Canvas/ProjectionsEditorCanvas.h b/GUI/View/Canvas/ProjectionsEditorCanvas.h index cc42a215777..140f38635e3 100644 --- a/GUI/View/Canvas/ProjectionsEditorCanvas.h +++ b/GUI/View/Canvas/ProjectionsEditorCanvas.h @@ -52,7 +52,7 @@ public slots: void onLeavingColorMap(); void onPositionChanged(double x, double y); void onResetViewRequest(); - void onActivityChanged(MaskFlags::MaskMode mask_mode); + void setProjectionsCanvasMode(MaskFlags::MaskMode mask_mode); private: void onLineItemMoved(LineItem* sender); diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp index e2d3cc62a31..f01e774602f 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp @@ -105,7 +105,7 @@ void Plot2DWithProjectionFrame::setup_connections() // selection/drawing activity is propagated from Toolbar to graphics scene connect(m_toolbar, &ProjectionsToolpanel::activityChanged, m_projectionsCanvas, - &ProjectionsEditorCanvas::onActivityChanged, Qt::UniqueConnection); + &ProjectionsEditorCanvas::setProjectionsCanvasMode, Qt::UniqueConnection); // selection/drawing activity is propagated from Toolbar to Projections Widget connect(m_toolbar, &ProjectionsToolpanel::activityChanged, m_projectionsWidget, -- GitLab From 767af0939ef72347aa0f87d0cabc43f18cc0349a Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 13:48:54 +0100 Subject: [PATCH 05/28] inline const strings --- GUI/View/Setup/ProjectionsToolpanel.cpp | 32 +++++++------------------ 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/GUI/View/Setup/ProjectionsToolpanel.cpp b/GUI/View/Setup/ProjectionsToolpanel.cpp index 5a4a62b5be7..f35e5c9577c 100644 --- a/GUI/View/Setup/ProjectionsToolpanel.cpp +++ b/GUI/View/Setup/ProjectionsToolpanel.cpp @@ -18,24 +18,6 @@ #include <QLabel> #include <QToolButton> -namespace { - -const QString pan_zoom_tooltip = "Pan/zoom mode (space)\n" - "Drag axes with the mouse, use mouse wheel to zoom in/out"; - -const QString reset_view_tooltip = "Reset view\nx,y,z axes range will be set to default"; - -const QString selection_mode_tooltip = - "Selection mode\nYou can select existing projections and move them around"; - -const QString horizontal_mode_tooltip = - "Horizontal projections mode\nCreate projection along x-axis by clicking on color map"; - -const QString vertical_mode_tooltip = - "Vertical projections mode\nCreate projection along y-axis by clicking on color map"; - -} // namespace - ProjectionsToolpanel::ProjectionsToolpanel(ProjectionActions* editorActions, QWidget* parent) : QToolBar(parent) , m_editorActions(editorActions) @@ -71,14 +53,15 @@ void ProjectionsToolpanel::setup_selection_group() { auto* panButton = new QToolButton(this); panButton->setIcon(QIcon(":/images/hand-right.svg")); - panButton->setToolTip(pan_zoom_tooltip); + panButton->setToolTip("Pan/zoom mode (space)\n" + "Drag axes with the mouse, use mouse wheel to zoom in/out"); panButton->setCheckable(true); panButton->setChecked(true); addWidget(panButton); auto* resetViewButton = new QToolButton(this); resetViewButton->setIcon(QIcon(":/images/camera-metering-center.svg")); - resetViewButton->setToolTip(reset_view_tooltip); + resetViewButton->setToolTip("Reset view\nx,y,z axes range will be set to default"); addWidget(resetViewButton); connect(resetViewButton, &QToolButton::clicked, m_editorActions, &ProjectionActions::resetViewRequest); @@ -87,7 +70,8 @@ void ProjectionsToolpanel::setup_selection_group() auto* selectionButton = new QToolButton(this); selectionButton->setIcon(QIcon(":/images/maskeditor_arrow.svg")); - selectionButton->setToolTip(selection_mode_tooltip); + selectionButton->setToolTip( + "Selection mode\nYou can select existing projections and move them around"); selectionButton->setCheckable(true); addWidget(selectionButton); @@ -99,13 +83,15 @@ void ProjectionsToolpanel::setup_shapes_group() { auto* horizontalLineButton = new QToolButton(this); horizontalLineButton->setIcon(QIcon(":/images/maskeditor_horizontalline.svg")); - horizontalLineButton->setToolTip(horizontal_mode_tooltip); + horizontalLineButton->setToolTip( + "Horizontal projections mode\nCreate projection along x-axis by clicking on color map"); horizontalLineButton->setCheckable(true); addWidget(horizontalLineButton); auto* verticalLineButton = new QToolButton(this); verticalLineButton->setIcon(QIcon(":/images/maskeditor_verticalline.svg")); - verticalLineButton->setToolTip(vertical_mode_tooltip); + verticalLineButton->setToolTip( + "Vertical projections mode\nCreate projection along y-axis by clicking on color map"); verticalLineButton->setCheckable(true); addWidget(verticalLineButton); -- GitLab From ea3206de9456d5cf658efdcaaadde53ae8702280 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 13:55:59 +0100 Subject: [PATCH 06/28] inline setup fcts --- GUI/View/Setup/ProjectionsToolpanel.cpp | 53 +++++++++++-------------- GUI/View/Setup/ProjectionsToolpanel.h | 3 -- 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/GUI/View/Setup/ProjectionsToolpanel.cpp b/GUI/View/Setup/ProjectionsToolpanel.cpp index f35e5c9577c..c0cd24efd8b 100644 --- a/GUI/View/Setup/ProjectionsToolpanel.cpp +++ b/GUI/View/Setup/ProjectionsToolpanel.cpp @@ -26,31 +26,8 @@ ProjectionsToolpanel::ProjectionsToolpanel(ProjectionActions* editorActions, QWi setIconSize(QSize(GUI::Style::toolbar_icon_size, GUI::Style::toolbar_icon_size)); setProperty("_q_custom_style_disabled", QVariant(true)); - setup_selection_group(); - setup_shapes_group(); - setup_extratools_group(); + //... Selection group - connect(m_activityButtonGroup, &QButtonGroup::idClicked, - [this] { emit activityChanged(currentActivity()); }); -} - -void ProjectionsToolpanel::onChangeActivityRequest(MaskFlags::MaskMode mask_mode) -{ - setCurrentActivity(mask_mode); - emit activityChanged(currentActivity()); -} - -//! Change activity only if current activity is one of drawing mode (horizontal, vertical -//! projections drawing). -void ProjectionsToolpanel::onProjectionTabChange(MaskFlags::MaskMode mask_mode) -{ - if (currentActivity() == MaskFlags::HORIZONTAL_LINE_MODE - || currentActivity() == MaskFlags::VERTICAL_LINE_MODE) - onChangeActivityRequest(mask_mode); -} - -void ProjectionsToolpanel::setup_selection_group() -{ auto* panButton = new QToolButton(this); panButton->setIcon(QIcon(":/images/hand-right.svg")); panButton->setToolTip("Pan/zoom mode (space)\n" @@ -77,10 +54,9 @@ void ProjectionsToolpanel::setup_selection_group() m_activityButtonGroup->addButton(panButton, MaskFlags::PAN_ZOOM_MODE); m_activityButtonGroup->addButton(selectionButton, MaskFlags::SELECTION_MODE); -} -void ProjectionsToolpanel::setup_shapes_group() -{ + //... Shapes group + auto* horizontalLineButton = new QToolButton(this); horizontalLineButton->setIcon(QIcon(":/images/maskeditor_horizontalline.svg")); horizontalLineButton->setToolTip( @@ -98,11 +74,13 @@ void ProjectionsToolpanel::setup_shapes_group() m_activityButtonGroup->addButton(verticalLineButton, MaskFlags::VERTICAL_LINE_MODE); m_activityButtonGroup->addButton(horizontalLineButton, MaskFlags::HORIZONTAL_LINE_MODE); + connect(m_activityButtonGroup, &QButtonGroup::idClicked, + [this] { emit activityChanged(currentActivity()); }); + add_separator(); -} -void ProjectionsToolpanel::setup_extratools_group() -{ + //... Extratools group + auto* saveButton = new QToolButton(this); saveButton->setIcon(QIcon(":/images/maskeditor_save.svg")); saveButton->setToolTip("Save created projections in multi-column ASCII file."); @@ -110,6 +88,21 @@ void ProjectionsToolpanel::setup_extratools_group() connect(saveButton, &QToolButton::clicked, m_editorActions, &ProjectionActions::onSaveAction); } +void ProjectionsToolpanel::onChangeActivityRequest(MaskFlags::MaskMode mask_mode) +{ + setCurrentActivity(mask_mode); + emit activityChanged(currentActivity()); +} + +//! Change activity only if current activity is one of drawing mode (horizontal, vertical +//! projections drawing). +void ProjectionsToolpanel::onProjectionTabChange(MaskFlags::MaskMode mask_mode) +{ + if (currentActivity() == MaskFlags::HORIZONTAL_LINE_MODE + || currentActivity() == MaskFlags::VERTICAL_LINE_MODE) + onChangeActivityRequest(mask_mode); +} + void ProjectionsToolpanel::add_separator() { addWidget(new QLabel(" ")); diff --git a/GUI/View/Setup/ProjectionsToolpanel.h b/GUI/View/Setup/ProjectionsToolpanel.h index 53c29dea671..43a5ebdaad6 100644 --- a/GUI/View/Setup/ProjectionsToolpanel.h +++ b/GUI/View/Setup/ProjectionsToolpanel.h @@ -37,9 +37,6 @@ signals: void activityChanged(MaskFlags::MaskMode); private: - void setup_selection_group(); - void setup_shapes_group(); - void setup_extratools_group(); void add_separator(); MaskFlags::MaskMode currentActivity() const; void setCurrentActivity(MaskFlags::MaskMode mask_mode); -- GitLab From e259109e17fe0b84312a6f22910278ddc5e57ae0 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 14:51:27 +0100 Subject: [PATCH 07/28] rename class and sources GUI/View/Canvas/MaskToolbox -> GUI/View/Setup/MaskToolbar --- Doc/graph/mask-classes.gv | 6 +++--- GUI/View/Frame/MaskEditingFrame.cpp | 12 ++++++------ .../MaskToolbox.cpp => Setup/MaskToolbar.cpp} | 16 ++++++++-------- .../MaskToolbox.h => Setup/MaskToolbar.h} | 14 +++++++------- 4 files changed, 24 insertions(+), 24 deletions(-) rename GUI/View/{Canvas/MaskToolbox.cpp => Setup/MaskToolbar.cpp} (94%) rename GUI/View/{Canvas/MaskToolbox.h => Setup/MaskToolbar.h} (76%) diff --git a/Doc/graph/mask-classes.gv b/Doc/graph/mask-classes.gv index 6f6ff7498f7..811e3435a4d 100644 --- a/Doc/graph/mask-classes.gv +++ b/Doc/graph/mask-classes.gv @@ -14,9 +14,9 @@ MaskEditingFrame[label="MaskEditingFrame\n< DataAccessWidget\n< QWidget" style=f MaskEditingFrame->MaskEditorActions; MaskEditingFrame->MaskPanel; MaskEditingFrame->MaskEditorCanvas; -MaskEditingFrame->MaskToolbox[style=dashed color=blue] +MaskEditingFrame->MaskToolbar[style=dashed color=blue] -MaskToolbox[label="MaskToolbox\n< QToolBar\n< QWidget" style=filled fillcolor=orchid] +MaskToolbar[label="MaskToolbar\n< QToolBar\n< QWidget" style=filled fillcolor=orchid] MaskEditorActions[label="MaskEditorActions\n< QObject" style=filled fillcolor=beige]; MaskEditorActions->MaskeditorListmodel; @@ -65,7 +65,7 @@ MaskGraphicsProxy[label="MaskGraphicsProxy\n< QGraphicsProxyWidget\n... < QGraph ColorMap[label="ColorMap\n< ScientificPlot\n< QWidget" style=filled fillcolor=orchid]; ColorMap->Data2DItem; -MaskToolbox->MaskEditorActions[style=dotted color=magenta]; +MaskToolbar->MaskEditorActions[style=dotted color=magenta]; Data2DItem[label="Data2DItem\n< DataItem\n< QObject" style=filled fillcolor=beige]; Data2DItem->MaskList; diff --git a/GUI/View/Frame/MaskEditingFrame.cpp b/GUI/View/Frame/MaskEditingFrame.cpp index 976c43c2416..0d2af424422 100644 --- a/GUI/View/Frame/MaskEditingFrame.cpp +++ b/GUI/View/Frame/MaskEditingFrame.cpp @@ -18,9 +18,9 @@ #include "GUI/Model/Mask/MaskeditorListmodel.h" #include "GUI/View/Canvas/MaskEditorActions.h" #include "GUI/View/Canvas/MaskEditorCanvas.h" -#include "GUI/View/Canvas/MaskToolbox.h" #include "GUI/View/Scene/MaskGraphicsScene.h" #include "GUI/View/Setup/MaskPanel.h" +#include "GUI/View/Setup/MaskToolbar.h" #include <QSplitter> #include <QVBoxLayout> @@ -41,7 +41,7 @@ MaskEditingFrame::MaskEditingFrame(QWidget* parent) splitter->addWidget(m_panel); splitter->setCollapsible(1, true); - auto* toolbox = new MaskToolbox(m_actions); + auto* toolbox = new MaskToolbar(m_actions); layout->addWidget(toolbox); toolbox->setOrientation(Qt::Vertical); toolbox->setStyleSheet("QToolBar{border-left:1px solid rgb(180,180,180);}"); @@ -59,18 +59,18 @@ MaskEditingFrame::MaskEditingFrame(QWidget* parent) connect(m_actions, &MaskEditorActions::savePlotRequest, m_canvas, &MaskEditorCanvas::onSavePlotRequest); - connect(toolbox, &MaskToolbox::activityChanged, m_canvas->getScene(), + connect(toolbox, &MaskToolbar::activityChanged, m_canvas->getScene(), &MaskGraphicsScene::onActivityChanged); - connect(toolbox, &MaskToolbox::maskValueChanged, m_canvas->getScene(), + connect(toolbox, &MaskToolbar::maskValueChanged, m_canvas->getScene(), &MaskGraphicsScene::onMaskValueChanged); - connect(toolbox, &MaskToolbox::presentationChange, m_canvas, + connect(toolbox, &MaskToolbar::presentationChange, m_canvas, &MaskEditorCanvas::onPresentationChange); // space bar push (request for zoom mode) connect(m_canvas, &MaskEditorCanvas::changeActivityRequest, toolbox, - &MaskToolbox::onChangeActivityRequest); + &MaskToolbar::onChangeActivityRequest); connect(m_canvas, &MaskEditorCanvas::deleteSelectedRequest, m_actions, &MaskEditorActions::onDeleteMaskAction); diff --git a/GUI/View/Canvas/MaskToolbox.cpp b/GUI/View/Setup/MaskToolbar.cpp similarity index 94% rename from GUI/View/Canvas/MaskToolbox.cpp rename to GUI/View/Setup/MaskToolbar.cpp index c8f2dd39380..fd3e15eebea 100644 --- a/GUI/View/Canvas/MaskToolbox.cpp +++ b/GUI/View/Setup/MaskToolbar.cpp @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/Canvas/MaskToolbox.cpp -//! @brief Implements class MaskToolbox. +//! @file GUI/View/Setup/MaskToolbar.cpp +//! @brief Implements class MaskToolbar. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,7 +12,7 @@ // // ************************************************************************************************ -#include "GUI/View/Canvas/MaskToolbox.h" +#include "GUI/View/Setup/MaskToolbar.h" #include "Base/Util/Assert.h" #include "GUI/View/Canvas/MaskEditorActions.h" #include "GUI/View/Tool/mainwindow_constants.h" @@ -22,7 +22,7 @@ #include <QToolButton> #include <QVariant> -MaskToolbox::MaskToolbox(MaskEditorActions* actions, QWidget* parent) +MaskToolbar::MaskToolbar(MaskEditorActions* actions, QWidget* parent) : QToolBar(parent) , m_activityButtonGroup(new QButtonGroup(this)) { @@ -168,25 +168,25 @@ MaskToolbox::MaskToolbox(MaskEditorActions* actions, QWidget* parent) add_separator(); } -void MaskToolbox::onChangeActivityRequest(MaskFlags::MaskMode mask_mode) +void MaskToolbar::onChangeActivityRequest(MaskFlags::MaskMode mask_mode) { setCurrentActivity(mask_mode); emit activityChanged(currentActivity()); } -void MaskToolbox::add_separator() +void MaskToolbar::add_separator() { addWidget(new QLabel(" ")); addSeparator(); addWidget(new QLabel(" ")); } -MaskFlags::MaskMode MaskToolbox::currentActivity() const +MaskFlags::MaskMode MaskToolbar::currentActivity() const { return MaskFlags::EMaskMode(m_activityButtonGroup->checkedId()); } -void MaskToolbox::setCurrentActivity(MaskFlags::MaskMode mask_mode) +void MaskToolbar::setCurrentActivity(MaskFlags::MaskMode mask_mode) { m_activityButtonGroup->button(mask_mode)->setChecked(true); } diff --git a/GUI/View/Canvas/MaskToolbox.h b/GUI/View/Setup/MaskToolbar.h similarity index 76% rename from GUI/View/Canvas/MaskToolbox.h rename to GUI/View/Setup/MaskToolbar.h index 9b586666bfb..3d1b44cc48a 100644 --- a/GUI/View/Canvas/MaskToolbox.h +++ b/GUI/View/Setup/MaskToolbar.h @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/Canvas/MaskToolbox.h -//! @brief Defines class MaskToolbox. +//! @file GUI/View/Setup/MaskToolbar.h +//! @brief Defines class MaskToolbar. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_VIEW_CANVAS_MASKTOOLBOX_H -#define BORNAGAIN_GUI_VIEW_CANVAS_MASKTOOLBOX_H +#ifndef BORNAGAIN_GUI_VIEW_SETUP_MASKTOOLBAR_H +#define BORNAGAIN_GUI_VIEW_SETUP_MASKTOOLBAR_H #include "GUI/View/Scene/MaskFlags.h" #include <QButtonGroup> @@ -23,10 +23,10 @@ class MaskEditorActions; //! Iconic representation of mask editing tools. -class MaskToolbox : public QToolBar { +class MaskToolbar : public QToolBar { Q_OBJECT public: - MaskToolbox(MaskEditorActions* actions, QWidget* parent = nullptr); + MaskToolbar(MaskEditorActions* actions, QWidget* parent = nullptr); signals: void activityChanged(MaskFlags::MaskMode); @@ -45,4 +45,4 @@ private: QButtonGroup* m_activityButtonGroup; }; -#endif // BORNAGAIN_GUI_VIEW_CANVAS_MASKTOOLBOX_H +#endif // BORNAGAIN_GUI_VIEW_SETUP_MASKTOOLBAR_H -- GitLab From bcb0a8587672d73535ac7411c66423e89c5aa3ff Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 14:51:53 +0100 Subject: [PATCH 08/28] rename class and sources GUI/View/Setup/ProjectionsToolpanel -> GUI/View/Setup/ProjectionToolbar --- Doc/graph/projn-classes.gv | 4 +-- GUI/View/Frame/Plot2DWithProjectionFrame.cpp | 12 ++++----- GUI/View/Frame/Plot2DWithProjectionFrame.h | 4 +-- ...onsToolpanel.cpp => ProjectionToolbar.cpp} | 26 +++++++++---------- ...ectionsToolpanel.h => ProjectionToolbar.h} | 14 +++++----- 5 files changed, 30 insertions(+), 30 deletions(-) rename GUI/View/Setup/{ProjectionsToolpanel.cpp => ProjectionToolbar.cpp} (80%) rename GUI/View/Setup/{ProjectionsToolpanel.h => ProjectionToolbar.h} (75%) diff --git a/Doc/graph/projn-classes.gv b/Doc/graph/projn-classes.gv index 8483b041594..833142edd25 100644 --- a/Doc/graph/projn-classes.gv +++ b/Doc/graph/projn-classes.gv @@ -7,7 +7,7 @@ digraph maskClasses Plot2DWithProjectionFrame->DataAccessWidget[arrowhead=onormal color=chocolate4]; Plot2DWithProjectionFrame->ProjectionActions; - Plot2DWithProjectionFrame->ProjectionsToolpanel; + Plot2DWithProjectionFrame->ProjectionToolbar; Plot2DWithProjectionFrame->ProjectionsEditorCanvas; Plot2DWithProjectionFrame->ProjectionsWidget; Plot2DWithProjectionFrame->Scale2DEditor; @@ -15,7 +15,7 @@ digraph maskClasses ProjectionActions->MaskeditorListmodel; ProjectionActions->Data2DItem; - ProjectionsToolpanel->ProjectionActions; + ProjectionToolbar->ProjectionActions; ProjectionsEditorCanvas->MaskGraphicsScene; ProjectionsEditorCanvas->MaskGraphicsView; diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp index f01e774602f..0c754d7ad00 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp @@ -19,7 +19,7 @@ #include "GUI/View/Canvas/ProjectionsEditorCanvas.h" #include "GUI/View/Canvas/ProjectionsWidget.h" #include "GUI/View/Setup/ProjectionActions.h" -#include "GUI/View/Setup/ProjectionsToolpanel.h" +#include "GUI/View/Setup/ProjectionToolbar.h" #include "GUI/View/Setup/Scale2DEditor.h" #include <QBoxLayout> #include <QSplitter> @@ -27,7 +27,7 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) : DataAccessWidget(parent) , m_editorActions(new ProjectionActions(this)) - , m_toolbar(new ProjectionsToolpanel(m_editorActions)) + , m_toolbar(new ProjectionToolbar(m_editorActions)) , m_projectionsCanvas(new ProjectionsEditorCanvas) , m_projectionsWidget(new ProjectionsWidget) , m_scaleEditor(new Scale2DEditor(this)) @@ -104,16 +104,16 @@ void Plot2DWithProjectionFrame::setup_connections() [this] { m_scaleEditor->setHidden(!m_scaleEditor->isHidden()); }); // selection/drawing activity is propagated from Toolbar to graphics scene - connect(m_toolbar, &ProjectionsToolpanel::activityChanged, m_projectionsCanvas, + connect(m_toolbar, &ProjectionToolbar::activityChanged, m_projectionsCanvas, &ProjectionsEditorCanvas::setProjectionsCanvasMode, Qt::UniqueConnection); // selection/drawing activity is propagated from Toolbar to Projections Widget - connect(m_toolbar, &ProjectionsToolpanel::activityChanged, m_projectionsWidget, + connect(m_toolbar, &ProjectionToolbar::activityChanged, m_projectionsWidget, &ProjectionsWidget::onActivityChanged, Qt::UniqueConnection); // click on projections tab is propagated to tool bar connect(m_projectionsWidget, &ProjectionsWidget::changeActivityRequest, m_toolbar, - &ProjectionsToolpanel::onProjectionTabChange, Qt::UniqueConnection); + &ProjectionToolbar::onProjectionTabChange, Qt::UniqueConnection); // Delete request is propagated from canvas to actions connect(m_projectionsCanvas, &ProjectionsEditorCanvas::deleteSelectedRequest, m_editorActions, @@ -125,7 +125,7 @@ void Plot2DWithProjectionFrame::setup_connections() // space bar push (request for zoom mode) is propagated from graphics view to Toolbar connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeActivityRequest, m_toolbar, - &ProjectionsToolpanel::onChangeActivityRequest, Qt::UniqueConnection); + &ProjectionToolbar::onChangeActivityRequest, Qt::UniqueConnection); // ColorMap margins changed, canvas -> projection widget connect(m_projectionsCanvas, &ProjectionsEditorCanvas::marginsChanged, m_projectionsWidget, diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.h b/GUI/View/Frame/Plot2DWithProjectionFrame.h index dd67b51fc14..a59c96c8c6d 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.h +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.h @@ -19,7 +19,7 @@ class ProjectionActions; class ProjectionsEditorCanvas; -class ProjectionsToolpanel; +class ProjectionToolbar; class ProjectionsWidget; class Scale2DEditor; @@ -41,7 +41,7 @@ private: void setup_connections(); ProjectionActions* m_editorActions; - ProjectionsToolpanel* m_toolbar; //! main tool bar with buttons at the right + ProjectionToolbar* m_toolbar; //! main tool bar with buttons at the right ProjectionsEditorCanvas* m_projectionsCanvas; //! canvas with color map at the top ProjectionsWidget* m_projectionsWidget; //! bottom widget to draw projections plot Scale2DEditor* m_scaleEditor; //! panel at the right with properties diff --git a/GUI/View/Setup/ProjectionsToolpanel.cpp b/GUI/View/Setup/ProjectionToolbar.cpp similarity index 80% rename from GUI/View/Setup/ProjectionsToolpanel.cpp rename to GUI/View/Setup/ProjectionToolbar.cpp index c0cd24efd8b..ad3e6a982a1 100644 --- a/GUI/View/Setup/ProjectionsToolpanel.cpp +++ b/GUI/View/Setup/ProjectionToolbar.cpp @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/Setup/ProjectionsToolpanel.cpp -//! @brief Implements class ProjectionsToolpanel. +//! @file GUI/View/Setup/ProjectionToolbar.cpp +//! @brief Implements class ProjectionToolbar. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,13 +12,13 @@ // // ************************************************************************************************ -#include "GUI/View/Setup/ProjectionsToolpanel.h" +#include "GUI/View/Setup/ProjectionToolbar.h" #include "GUI/View/Setup/ProjectionActions.h" #include "GUI/View/Tool/mainwindow_constants.h" #include <QLabel> #include <QToolButton> -ProjectionsToolpanel::ProjectionsToolpanel(ProjectionActions* editorActions, QWidget* parent) +ProjectionToolbar::ProjectionToolbar(ProjectionActions* editorActions, QWidget* parent) : QToolBar(parent) , m_editorActions(editorActions) , m_activityButtonGroup(new QButtonGroup(this)) @@ -31,7 +31,7 @@ ProjectionsToolpanel::ProjectionsToolpanel(ProjectionActions* editorActions, QWi auto* panButton = new QToolButton(this); panButton->setIcon(QIcon(":/images/hand-right.svg")); panButton->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); panButton->setChecked(true); addWidget(panButton); @@ -48,7 +48,7 @@ ProjectionsToolpanel::ProjectionsToolpanel(ProjectionActions* editorActions, QWi auto* selectionButton = new QToolButton(this); selectionButton->setIcon(QIcon(":/images/maskeditor_arrow.svg")); selectionButton->setToolTip( - "Selection mode\nYou can select existing projections and move them around"); + "Selection mode\nYou can select existing projections and move them around"); selectionButton->setCheckable(true); addWidget(selectionButton); @@ -60,14 +60,14 @@ ProjectionsToolpanel::ProjectionsToolpanel(ProjectionActions* editorActions, QWi auto* horizontalLineButton = new QToolButton(this); horizontalLineButton->setIcon(QIcon(":/images/maskeditor_horizontalline.svg")); horizontalLineButton->setToolTip( - "Horizontal projections mode\nCreate projection along x-axis by clicking on color map"); + "Horizontal projections mode\nCreate projection along x-axis by clicking on color map"); horizontalLineButton->setCheckable(true); addWidget(horizontalLineButton); auto* verticalLineButton = new QToolButton(this); verticalLineButton->setIcon(QIcon(":/images/maskeditor_verticalline.svg")); verticalLineButton->setToolTip( - "Vertical projections mode\nCreate projection along y-axis by clicking on color map"); + "Vertical projections mode\nCreate projection along y-axis by clicking on color map"); verticalLineButton->setCheckable(true); addWidget(verticalLineButton); @@ -88,7 +88,7 @@ ProjectionsToolpanel::ProjectionsToolpanel(ProjectionActions* editorActions, QWi connect(saveButton, &QToolButton::clicked, m_editorActions, &ProjectionActions::onSaveAction); } -void ProjectionsToolpanel::onChangeActivityRequest(MaskFlags::MaskMode mask_mode) +void ProjectionToolbar::onChangeActivityRequest(MaskFlags::MaskMode mask_mode) { setCurrentActivity(mask_mode); emit activityChanged(currentActivity()); @@ -96,26 +96,26 @@ void ProjectionsToolpanel::onChangeActivityRequest(MaskFlags::MaskMode mask_mode //! Change activity only if current activity is one of drawing mode (horizontal, vertical //! projections drawing). -void ProjectionsToolpanel::onProjectionTabChange(MaskFlags::MaskMode mask_mode) +void ProjectionToolbar::onProjectionTabChange(MaskFlags::MaskMode mask_mode) { if (currentActivity() == MaskFlags::HORIZONTAL_LINE_MODE || currentActivity() == MaskFlags::VERTICAL_LINE_MODE) onChangeActivityRequest(mask_mode); } -void ProjectionsToolpanel::add_separator() +void ProjectionToolbar::add_separator() { addWidget(new QLabel(" ")); addSeparator(); addWidget(new QLabel(" ")); } -MaskFlags::MaskMode ProjectionsToolpanel::currentActivity() const +MaskFlags::MaskMode ProjectionToolbar::currentActivity() const { return MaskFlags::EMaskMode(m_activityButtonGroup->checkedId()); } -void ProjectionsToolpanel::setCurrentActivity(MaskFlags::MaskMode mask_mode) +void ProjectionToolbar::setCurrentActivity(MaskFlags::MaskMode mask_mode) { int button_index = static_cast<int>(mask_mode); m_activityButtonGroup->button(button_index)->setChecked(true); diff --git a/GUI/View/Setup/ProjectionsToolpanel.h b/GUI/View/Setup/ProjectionToolbar.h similarity index 75% rename from GUI/View/Setup/ProjectionsToolpanel.h rename to GUI/View/Setup/ProjectionToolbar.h index 43a5ebdaad6..563cfc2a14d 100644 --- a/GUI/View/Setup/ProjectionsToolpanel.h +++ b/GUI/View/Setup/ProjectionToolbar.h @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/Setup/ProjectionsToolpanel.h -//! @brief Defines class ProjectionsToolpanel. +//! @file GUI/View/Setup/ProjectionToolbar.h +//! @brief Defines class ProjectionToolbar. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_VIEW_SETUP_PROJECTIONSTOOLPANEL_H -#define BORNAGAIN_GUI_VIEW_SETUP_PROJECTIONSTOOLPANEL_H +#ifndef BORNAGAIN_GUI_VIEW_SETUP_PROJECTIONTOOLBAR_H +#define BORNAGAIN_GUI_VIEW_SETUP_PROJECTIONTOOLBAR_H #include "GUI/View/Scene/MaskFlags.h" #include <QButtonGroup> @@ -24,10 +24,10 @@ class ProjectionActions; //! Toolbar with projections buttons (horizontal projections, vertical projections, select, zoom) //! located at the right-hand side of ProjectionsEditor (part of JobProjectionsWidget). -class ProjectionsToolpanel : public QToolBar { +class ProjectionToolbar : public QToolBar { Q_OBJECT public: - ProjectionsToolpanel(ProjectionActions* editorActions, QWidget* parent = nullptr); + ProjectionToolbar(ProjectionActions* editorActions, QWidget* parent = nullptr); public slots: void onChangeActivityRequest(MaskFlags::MaskMode mask_mode); @@ -45,4 +45,4 @@ private: QButtonGroup* m_activityButtonGroup; }; -#endif // BORNAGAIN_GUI_VIEW_SETUP_PROJECTIONSTOOLPANEL_H +#endif // BORNAGAIN_GUI_VIEW_SETUP_PROJECTIONTOOLBAR_H -- GitLab From f7d61574ce145b1fb929179297dfb5535b633b26 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 15:29:00 +0100 Subject: [PATCH 09/28] mv style setting statements --- GUI/View/Frame/MaskEditingFrame.cpp | 2 -- GUI/View/Setup/MaskToolbar.cpp | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/GUI/View/Frame/MaskEditingFrame.cpp b/GUI/View/Frame/MaskEditingFrame.cpp index 0d2af424422..ff85cf7d6ab 100644 --- a/GUI/View/Frame/MaskEditingFrame.cpp +++ b/GUI/View/Frame/MaskEditingFrame.cpp @@ -43,8 +43,6 @@ MaskEditingFrame::MaskEditingFrame(QWidget* parent) auto* toolbox = new MaskToolbar(m_actions); layout->addWidget(toolbox); - toolbox->setOrientation(Qt::Vertical); - toolbox->setStyleSheet("QToolBar{border-left:1px solid rgb(180,180,180);}"); m_panel->setPanelHidden(true); diff --git a/GUI/View/Setup/MaskToolbar.cpp b/GUI/View/Setup/MaskToolbar.cpp index fd3e15eebea..b832ade019d 100644 --- a/GUI/View/Setup/MaskToolbar.cpp +++ b/GUI/View/Setup/MaskToolbar.cpp @@ -26,8 +26,9 @@ MaskToolbar::MaskToolbar(MaskEditorActions* actions, QWidget* parent) : QToolBar(parent) , m_activityButtonGroup(new QButtonGroup(this)) { + setOrientation(Qt::Vertical); + setStyleSheet("border-left:1px solid rgb(180,180,180)"); setIconSize(QSize(GUI::Style::toolbar_icon_size, GUI::Style::toolbar_icon_size)); - setProperty("_q_custom_style_disabled", QVariant(true)); //... Zoom / selection mode -- GitLab From d7c328282aa4ee413f32ea59a669057412c7d380 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 15:30:46 +0100 Subject: [PATCH 10/28] rm parent; rm stylesheet disabling --- GUI/View/Setup/MaskToolbar.cpp | 5 ++--- GUI/View/Setup/MaskToolbar.h | 2 +- GUI/View/Setup/ProjectionToolbar.cpp | 6 ++---- GUI/View/Setup/ProjectionToolbar.h | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/GUI/View/Setup/MaskToolbar.cpp b/GUI/View/Setup/MaskToolbar.cpp index b832ade019d..9e1f0ec32a8 100644 --- a/GUI/View/Setup/MaskToolbar.cpp +++ b/GUI/View/Setup/MaskToolbar.cpp @@ -22,9 +22,8 @@ #include <QToolButton> #include <QVariant> -MaskToolbar::MaskToolbar(MaskEditorActions* actions, QWidget* parent) - : QToolBar(parent) - , m_activityButtonGroup(new QButtonGroup(this)) +MaskToolbar::MaskToolbar(MaskEditorActions* actions) + : m_activityButtonGroup(new QButtonGroup(this)) { setOrientation(Qt::Vertical); setStyleSheet("border-left:1px solid rgb(180,180,180)"); diff --git a/GUI/View/Setup/MaskToolbar.h b/GUI/View/Setup/MaskToolbar.h index 3d1b44cc48a..78d092809f8 100644 --- a/GUI/View/Setup/MaskToolbar.h +++ b/GUI/View/Setup/MaskToolbar.h @@ -26,7 +26,7 @@ class MaskEditorActions; class MaskToolbar : public QToolBar { Q_OBJECT public: - MaskToolbar(MaskEditorActions* actions, QWidget* parent = nullptr); + MaskToolbar(MaskEditorActions* actions); signals: void activityChanged(MaskFlags::MaskMode); diff --git a/GUI/View/Setup/ProjectionToolbar.cpp b/GUI/View/Setup/ProjectionToolbar.cpp index ad3e6a982a1..9e3dfc007f1 100644 --- a/GUI/View/Setup/ProjectionToolbar.cpp +++ b/GUI/View/Setup/ProjectionToolbar.cpp @@ -18,13 +18,11 @@ #include <QLabel> #include <QToolButton> -ProjectionToolbar::ProjectionToolbar(ProjectionActions* editorActions, QWidget* parent) - : QToolBar(parent) - , m_editorActions(editorActions) +ProjectionToolbar::ProjectionToolbar(ProjectionActions* editorActions) + : m_editorActions(editorActions) , m_activityButtonGroup(new QButtonGroup(this)) { setIconSize(QSize(GUI::Style::toolbar_icon_size, GUI::Style::toolbar_icon_size)); - setProperty("_q_custom_style_disabled", QVariant(true)); //... Selection group diff --git a/GUI/View/Setup/ProjectionToolbar.h b/GUI/View/Setup/ProjectionToolbar.h index 563cfc2a14d..2acfb7ed9b9 100644 --- a/GUI/View/Setup/ProjectionToolbar.h +++ b/GUI/View/Setup/ProjectionToolbar.h @@ -27,7 +27,7 @@ class ProjectionActions; class ProjectionToolbar : public QToolBar { Q_OBJECT public: - ProjectionToolbar(ProjectionActions* editorActions, QWidget* parent = nullptr); + ProjectionToolbar(ProjectionActions* editorActions); public slots: void onChangeActivityRequest(MaskFlags::MaskMode mask_mode); -- GitLab From c99d67c2fd0b6caec4a744b1a0b18fe5291ea92e Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 15:41:07 +0100 Subject: [PATCH 11/28] mv style setting statements --- GUI/View/Frame/Plot2DWithProjectionFrame.cpp | 2 -- GUI/View/Setup/ProjectionToolbar.cpp | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp index 0c754d7ad00..9a1a66f72e3 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp @@ -47,8 +47,6 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) m_scaleEditor->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); m_scaleEditor->setHidden(true); - m_toolbar->setOrientation(Qt::Vertical); - m_toolbar->setStyleSheet("QToolBar{border-left:1px solid rgb(180,180,180);}"); layout->addWidget(m_toolbar); setup_connections(); diff --git a/GUI/View/Setup/ProjectionToolbar.cpp b/GUI/View/Setup/ProjectionToolbar.cpp index 9e3dfc007f1..c4abf2f4bd5 100644 --- a/GUI/View/Setup/ProjectionToolbar.cpp +++ b/GUI/View/Setup/ProjectionToolbar.cpp @@ -22,6 +22,8 @@ ProjectionToolbar::ProjectionToolbar(ProjectionActions* editorActions) : m_editorActions(editorActions) , m_activityButtonGroup(new QButtonGroup(this)) { + setOrientation(Qt::Vertical); + setStyleSheet("border-left:1px solid rgb(180,180,180);"); setIconSize(QSize(GUI::Style::toolbar_icon_size, GUI::Style::toolbar_icon_size)); //... Selection group -- GitLab From 9ba921142105f101231b70db0e446369ed72b39e Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 15:42:19 +0100 Subject: [PATCH 12/28] inline fct --- GUI/View/Frame/Plot2DWithProjectionFrame.cpp | 79 +++++++++----------- GUI/View/Frame/Plot2DWithProjectionFrame.h | 1 - 2 files changed, 37 insertions(+), 43 deletions(-) diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp index 9a1a66f72e3..f6272e829ef 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp @@ -49,7 +49,43 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) layout->addWidget(m_toolbar); - setup_connections(); + // tool panel request is propagated from editorActions to this MaskEditor + connect(m_editorActions, &ProjectionActions::resetViewRequest, m_projectionsCanvas, + &ProjectionsEditorCanvas::onResetViewRequest, Qt::UniqueConnection); + + // tool panel request is propagated from editorActions to this MaskEditor + connect(m_editorActions, &ProjectionActions::propertyPanelRequest, + [this] { m_scaleEditor->setHidden(!m_scaleEditor->isHidden()); }); + + // selection/drawing activity is propagated from Toolbar to graphics scene + connect(m_toolbar, &ProjectionToolbar::activityChanged, m_projectionsCanvas, + &ProjectionsEditorCanvas::setProjectionsCanvasMode, Qt::UniqueConnection); + + // selection/drawing activity is propagated from Toolbar to Projections Widget + connect(m_toolbar, &ProjectionToolbar::activityChanged, m_projectionsWidget, + &ProjectionsWidget::onActivityChanged, Qt::UniqueConnection); + + // click on projections tab is propagated to tool bar + connect(m_projectionsWidget, &ProjectionsWidget::changeActivityRequest, m_toolbar, + &ProjectionToolbar::onProjectionTabChange, Qt::UniqueConnection); + + // Delete request is propagated from canvas to actions + connect(m_projectionsCanvas, &ProjectionsEditorCanvas::deleteSelectedRequest, m_editorActions, + &ProjectionActions::onDeleteAction, Qt::UniqueConnection); + + // moving projection automatically switches projections tab + connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeProjectionsTabRequest, + m_projectionsWidget, &ProjectionsWidget::onActivityChanged, Qt::UniqueConnection); + + // space bar push (request for zoom mode) is propagated from graphics view to Toolbar + connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeActivityRequest, m_toolbar, + &ProjectionToolbar::onChangeActivityRequest, Qt::UniqueConnection); + + // ColorMap margins changed, canvas -> projection widget + connect(m_projectionsCanvas, &ProjectionsEditorCanvas::marginsChanged, m_projectionsWidget, + &ProjectionsWidget::onMarginsChanged, Qt::UniqueConnection); + + m_toolbar->onChangeActivityRequest(MaskFlags::HORIZONTAL_LINE_MODE); } void Plot2DWithProjectionFrame::setJobOrDatafileItem(QObject* item) @@ -90,44 +126,3 @@ QList<QAction*> Plot2DWithProjectionFrame::actionList() { return m_editorActions->topToolboxActions(); } - -void Plot2DWithProjectionFrame::setup_connections() -{ - // tool panel request is propagated from editorActions to this MaskEditor - connect(m_editorActions, &ProjectionActions::resetViewRequest, m_projectionsCanvas, - &ProjectionsEditorCanvas::onResetViewRequest, Qt::UniqueConnection); - - // tool panel request is propagated from editorActions to this MaskEditor - connect(m_editorActions, &ProjectionActions::propertyPanelRequest, - [this] { m_scaleEditor->setHidden(!m_scaleEditor->isHidden()); }); - - // selection/drawing activity is propagated from Toolbar to graphics scene - connect(m_toolbar, &ProjectionToolbar::activityChanged, m_projectionsCanvas, - &ProjectionsEditorCanvas::setProjectionsCanvasMode, Qt::UniqueConnection); - - // selection/drawing activity is propagated from Toolbar to Projections Widget - connect(m_toolbar, &ProjectionToolbar::activityChanged, m_projectionsWidget, - &ProjectionsWidget::onActivityChanged, Qt::UniqueConnection); - - // click on projections tab is propagated to tool bar - connect(m_projectionsWidget, &ProjectionsWidget::changeActivityRequest, m_toolbar, - &ProjectionToolbar::onProjectionTabChange, Qt::UniqueConnection); - - // Delete request is propagated from canvas to actions - connect(m_projectionsCanvas, &ProjectionsEditorCanvas::deleteSelectedRequest, m_editorActions, - &ProjectionActions::onDeleteAction, Qt::UniqueConnection); - - // moving projection automatically switches projections tab - connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeProjectionsTabRequest, - m_projectionsWidget, &ProjectionsWidget::onActivityChanged, Qt::UniqueConnection); - - // space bar push (request for zoom mode) is propagated from graphics view to Toolbar - connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeActivityRequest, m_toolbar, - &ProjectionToolbar::onChangeActivityRequest, Qt::UniqueConnection); - - // ColorMap margins changed, canvas -> projection widget - connect(m_projectionsCanvas, &ProjectionsEditorCanvas::marginsChanged, m_projectionsWidget, - &ProjectionsWidget::onMarginsChanged, Qt::UniqueConnection); - - m_toolbar->onChangeActivityRequest(MaskFlags::HORIZONTAL_LINE_MODE); -} diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.h b/GUI/View/Frame/Plot2DWithProjectionFrame.h index a59c96c8c6d..24fbd5a3957 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.h +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.h @@ -38,7 +38,6 @@ private: void updateProjsFrame(); void showEvent(QShowEvent*) override; void hideEvent(QHideEvent*) override; - void setup_connections(); ProjectionActions* m_editorActions; ProjectionToolbar* m_toolbar; //! main tool bar with buttons at the right -- GitLab From 9a2e11ab44f552dc57b57defafe6bf1720d49de6 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 17:47:00 +0100 Subject: [PATCH 13/28] privatize --- GUI/View/Frame/MaskEditingFrame.cpp | 12 ++++++------ GUI/View/Frame/Plot2DWithProjectionFrame.cpp | 14 +++++++------- GUI/View/Frame/Plot2DWithProjectionFrame.h | 2 -- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/GUI/View/Frame/MaskEditingFrame.cpp b/GUI/View/Frame/MaskEditingFrame.cpp index ff85cf7d6ab..c1dbaedc7ce 100644 --- a/GUI/View/Frame/MaskEditingFrame.cpp +++ b/GUI/View/Frame/MaskEditingFrame.cpp @@ -41,8 +41,8 @@ MaskEditingFrame::MaskEditingFrame(QWidget* parent) splitter->addWidget(m_panel); splitter->setCollapsible(1, true); - auto* toolbox = new MaskToolbar(m_actions); - layout->addWidget(toolbox); + auto* toolbar = new MaskToolbar(m_actions); + layout->addWidget(toolbar); m_panel->setPanelHidden(true); @@ -57,17 +57,17 @@ MaskEditingFrame::MaskEditingFrame(QWidget* parent) connect(m_actions, &MaskEditorActions::savePlotRequest, m_canvas, &MaskEditorCanvas::onSavePlotRequest); - connect(toolbox, &MaskToolbar::activityChanged, m_canvas->getScene(), + connect(toolbar, &MaskToolbar::activityChanged, m_canvas->getScene(), &MaskGraphicsScene::onActivityChanged); - connect(toolbox, &MaskToolbar::maskValueChanged, m_canvas->getScene(), + connect(toolbar, &MaskToolbar::maskValueChanged, m_canvas->getScene(), &MaskGraphicsScene::onMaskValueChanged); - connect(toolbox, &MaskToolbar::presentationChange, m_canvas, + connect(toolbar, &MaskToolbar::presentationChange, m_canvas, &MaskEditorCanvas::onPresentationChange); // space bar push (request for zoom mode) - connect(m_canvas, &MaskEditorCanvas::changeActivityRequest, toolbox, + connect(m_canvas, &MaskEditorCanvas::changeActivityRequest, toolbar, &MaskToolbar::onChangeActivityRequest); connect(m_canvas, &MaskEditorCanvas::deleteSelectedRequest, m_actions, diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp index f6272e829ef..d3f7f6f76bb 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp @@ -27,7 +27,6 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) : DataAccessWidget(parent) , m_editorActions(new ProjectionActions(this)) - , m_toolbar(new ProjectionToolbar(m_editorActions)) , m_projectionsCanvas(new ProjectionsEditorCanvas) , m_projectionsWidget(new ProjectionsWidget) , m_scaleEditor(new Scale2DEditor(this)) @@ -47,7 +46,8 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) m_scaleEditor->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); m_scaleEditor->setHidden(true); - layout->addWidget(m_toolbar); + auto* toolbar = new ProjectionToolbar(m_editorActions); + layout->addWidget(toolbar); // tool panel request is propagated from editorActions to this MaskEditor connect(m_editorActions, &ProjectionActions::resetViewRequest, m_projectionsCanvas, @@ -58,15 +58,15 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) [this] { m_scaleEditor->setHidden(!m_scaleEditor->isHidden()); }); // selection/drawing activity is propagated from Toolbar to graphics scene - connect(m_toolbar, &ProjectionToolbar::activityChanged, m_projectionsCanvas, + connect(toolbar, &ProjectionToolbar::activityChanged, m_projectionsCanvas, &ProjectionsEditorCanvas::setProjectionsCanvasMode, Qt::UniqueConnection); // selection/drawing activity is propagated from Toolbar to Projections Widget - connect(m_toolbar, &ProjectionToolbar::activityChanged, m_projectionsWidget, + connect(toolbar, &ProjectionToolbar::activityChanged, m_projectionsWidget, &ProjectionsWidget::onActivityChanged, Qt::UniqueConnection); // click on projections tab is propagated to tool bar - connect(m_projectionsWidget, &ProjectionsWidget::changeActivityRequest, m_toolbar, + connect(m_projectionsWidget, &ProjectionsWidget::changeActivityRequest, toolbar, &ProjectionToolbar::onProjectionTabChange, Qt::UniqueConnection); // Delete request is propagated from canvas to actions @@ -78,14 +78,14 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) m_projectionsWidget, &ProjectionsWidget::onActivityChanged, Qt::UniqueConnection); // space bar push (request for zoom mode) is propagated from graphics view to Toolbar - connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeActivityRequest, m_toolbar, + connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeActivityRequest, toolbar, &ProjectionToolbar::onChangeActivityRequest, Qt::UniqueConnection); // ColorMap margins changed, canvas -> projection widget connect(m_projectionsCanvas, &ProjectionsEditorCanvas::marginsChanged, m_projectionsWidget, &ProjectionsWidget::onMarginsChanged, Qt::UniqueConnection); - m_toolbar->onChangeActivityRequest(MaskFlags::HORIZONTAL_LINE_MODE); + toolbar->onChangeActivityRequest(MaskFlags::HORIZONTAL_LINE_MODE); } void Plot2DWithProjectionFrame::setJobOrDatafileItem(QObject* item) diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.h b/GUI/View/Frame/Plot2DWithProjectionFrame.h index 24fbd5a3957..687ab5fd348 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.h +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.h @@ -19,7 +19,6 @@ class ProjectionActions; class ProjectionsEditorCanvas; -class ProjectionToolbar; class ProjectionsWidget; class Scale2DEditor; @@ -40,7 +39,6 @@ private: void hideEvent(QHideEvent*) override; ProjectionActions* m_editorActions; - ProjectionToolbar* m_toolbar; //! main tool bar with buttons at the right ProjectionsEditorCanvas* m_projectionsCanvas; //! canvas with color map at the top ProjectionsWidget* m_projectionsWidget; //! bottom widget to draw projections plot Scale2DEditor* m_scaleEditor; //! panel at the right with properties -- GitLab From a4e33f1a387b7857272a290d174089599d483564 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 18:07:06 +0100 Subject: [PATCH 14/28] make proj and mask frames more similar --- GUI/View/Frame/MaskEditingFrame.cpp | 1 + GUI/View/Frame/Plot2DWithProjectionFrame.cpp | 12 +++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/GUI/View/Frame/MaskEditingFrame.cpp b/GUI/View/Frame/MaskEditingFrame.cpp index c1dbaedc7ce..b19a4a563f5 100644 --- a/GUI/View/Frame/MaskEditingFrame.cpp +++ b/GUI/View/Frame/MaskEditingFrame.cpp @@ -37,6 +37,7 @@ MaskEditingFrame::MaskEditingFrame(QWidget* parent) auto* splitter = new QSplitter; layout->addWidget(splitter); + splitter->setOrientation(Qt::Horizontal); splitter->addWidget(m_canvas); splitter->addWidget(m_panel); splitter->setCollapsible(1, true); diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp index d3f7f6f76bb..35065c5e035 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp @@ -49,39 +49,33 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) auto* toolbar = new ProjectionToolbar(m_editorActions); layout->addWidget(toolbar); - // tool panel request is propagated from editorActions to this MaskEditor + //... Connections + connect(m_editorActions, &ProjectionActions::resetViewRequest, m_projectionsCanvas, &ProjectionsEditorCanvas::onResetViewRequest, Qt::UniqueConnection); - // tool panel request is propagated from editorActions to this MaskEditor connect(m_editorActions, &ProjectionActions::propertyPanelRequest, [this] { m_scaleEditor->setHidden(!m_scaleEditor->isHidden()); }); - // selection/drawing activity is propagated from Toolbar to graphics scene connect(toolbar, &ProjectionToolbar::activityChanged, m_projectionsCanvas, &ProjectionsEditorCanvas::setProjectionsCanvasMode, Qt::UniqueConnection); - // selection/drawing activity is propagated from Toolbar to Projections Widget connect(toolbar, &ProjectionToolbar::activityChanged, m_projectionsWidget, &ProjectionsWidget::onActivityChanged, Qt::UniqueConnection); - // click on projections tab is propagated to tool bar connect(m_projectionsWidget, &ProjectionsWidget::changeActivityRequest, toolbar, &ProjectionToolbar::onProjectionTabChange, Qt::UniqueConnection); - // Delete request is propagated from canvas to actions connect(m_projectionsCanvas, &ProjectionsEditorCanvas::deleteSelectedRequest, m_editorActions, &ProjectionActions::onDeleteAction, Qt::UniqueConnection); - // moving projection automatically switches projections tab connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeProjectionsTabRequest, m_projectionsWidget, &ProjectionsWidget::onActivityChanged, Qt::UniqueConnection); - // space bar push (request for zoom mode) is propagated from graphics view to Toolbar + // space bar push (request for zoom mode) connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeActivityRequest, toolbar, &ProjectionToolbar::onChangeActivityRequest, Qt::UniqueConnection); - // ColorMap margins changed, canvas -> projection widget connect(m_projectionsCanvas, &ProjectionsEditorCanvas::marginsChanged, m_projectionsWidget, &ProjectionsWidget::onMarginsChanged, Qt::UniqueConnection); -- GitLab From 987cdff642d45583c5db8343c9eddffc31604c4d Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 18:07:47 +0100 Subject: [PATCH 15/28] uniform m_actions --- GUI/View/Canvas/MaskEditorCanvas.cpp | 10 +++++----- GUI/View/Canvas/ProjectionsEditorCanvas.cpp | 12 ++++++------ GUI/View/Frame/Plot2DWithProjectionFrame.cpp | 14 +++++++------- GUI/View/Frame/Plot2DWithProjectionFrame.h | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/GUI/View/Canvas/MaskEditorCanvas.cpp b/GUI/View/Canvas/MaskEditorCanvas.cpp index cb080d8e380..b0cc258c13d 100644 --- a/GUI/View/Canvas/MaskEditorCanvas.cpp +++ b/GUI/View/Canvas/MaskEditorCanvas.cpp @@ -52,7 +52,7 @@ MaskEditorCanvas::~MaskEditorCanvas() = default; void MaskEditorCanvas::updateMaskCanvas(Data2DItem* data2DItem, QItemSelectionModel* selModel) { - std::cout<<"DEBG MaskEditorCanvas::updateMaskCanvas"<<std::endl; + std::cout << "DEBG MaskEditorCanvas::updateMaskCanvas" << std::endl; m_data2DItem = data2DItem; repaintScene(); @@ -63,7 +63,7 @@ void MaskEditorCanvas::updateMaskCanvas(Data2DItem* data2DItem, QItemSelectionMo void MaskEditorCanvas::resetMaskCanvas() { - std::cout<<"DEBG MaskEditorCanvas::resetMaskCanvas"<<std::endl; + std::cout << "DEBG MaskEditorCanvas::resetMaskCanvas" << std::endl; m_data2DItem = nullptr; m_scene->dissociateItems(); m_statusLabel->reset(); @@ -71,7 +71,7 @@ void MaskEditorCanvas::resetMaskCanvas() void MaskEditorCanvas::onPresentationChange(bool pixelized) { - std::cout<<"DEBG MaskEditorCanvas::onPresentationChange("<<std::endl; + std::cout << "DEBG MaskEditorCanvas::onPresentationChange(" << std::endl; m_scene->clearSelection(); // important to avoid crash (unsubscribe while calling subscribers) ASSERT(m_data2DItem); @@ -103,7 +103,7 @@ void MaskEditorCanvas::onPresentationChange(bool pixelized) void MaskEditorCanvas::repaintScene() { - std::cout<<"DEBG MaskEditorCanvas::repaintScene"<<std::endl; + std::cout << "DEBG MaskEditorCanvas::repaintScene" << std::endl; m_scene->updateSize(m_view->size()); // TODO replace by proper repaint command } @@ -118,7 +118,7 @@ void MaskEditorCanvas::onSavePlotRequest() void MaskEditorCanvas::onResetViewRequest() { - std::cout<<"DEBG MaskEditorCanvas::onResetViewRequest"<<std::endl; + std::cout << "DEBG MaskEditorCanvas::onResetViewRequest" << std::endl; m_view->onResetViewRequest(); if (m_data2DItem->isZoomed()) diff --git a/GUI/View/Canvas/ProjectionsEditorCanvas.cpp b/GUI/View/Canvas/ProjectionsEditorCanvas.cpp index b9a0d54a68c..fa8b959544c 100644 --- a/GUI/View/Canvas/ProjectionsEditorCanvas.cpp +++ b/GUI/View/Canvas/ProjectionsEditorCanvas.cpp @@ -56,7 +56,7 @@ ProjectionsEditorCanvas::~ProjectionsEditorCanvas() = default; void ProjectionsEditorCanvas::updateProjsCanvas(Data2DItem* data2DItem) { - std::cout<<"DEBG ProjectionsEditorCanvas::updateProjsCanvas"<<std::endl; + std::cout << "DEBG ProjectionsEditorCanvas::updateProjsCanvas" << std::endl; MaskeditorListmodel* mask_list_model = data2DItem->getOrCreateProjectionModel(); ASSERT(mask_list_model); @@ -82,7 +82,7 @@ void ProjectionsEditorCanvas::updateProjsCanvas(Data2DItem* data2DItem) void ProjectionsEditorCanvas::resetProjsCanvas() { - std::cout<<"DEBG ProjectionsEditorCanvas::resetProjsCanvas"<<std::endl; + std::cout << "DEBG ProjectionsEditorCanvas::resetProjsCanvas" << std::endl; setConnected(false); m_data2DItem = nullptr; m_colorMap = nullptr; @@ -91,7 +91,7 @@ void ProjectionsEditorCanvas::resetProjsCanvas() void ProjectionsEditorCanvas::onEnteringColorMap() { - std::cout<<"DEBG ProjectionsEditorCanvas::onEnteringColorMap"<<std::endl; + std::cout << "DEBG ProjectionsEditorCanvas::onEnteringColorMap" << std::endl; if (m_liveProjection || m_block_update) return; @@ -147,7 +147,7 @@ void ProjectionsEditorCanvas::onPositionChanged(double x, double y) void ProjectionsEditorCanvas::onResetViewRequest() { - std::cout<<"DEBG ProjectionsEditorCanvas::onResetViewRequest"<<std::endl; + std::cout << "DEBG ProjectionsEditorCanvas::onResetViewRequest" << std::endl; m_view->onResetViewRequest(); m_data2DItem->resetView(); gDoc->setModified(); @@ -155,7 +155,7 @@ void ProjectionsEditorCanvas::onResetViewRequest() void ProjectionsEditorCanvas::setProjectionsCanvasMode(MaskFlags::MaskMode mask_mode) { - std::cout<<"DEBG ProjectionsEditorCanvas::setProjectionsCanvasMode"<<std::endl; + std::cout << "DEBG ProjectionsEditorCanvas::setProjectionsCanvasMode" << std::endl; m_currentActivity = mask_mode; m_scene->onActivityChanged(mask_mode); onLeavingColorMap(); @@ -173,7 +173,7 @@ void ProjectionsEditorCanvas::onLineItemMoved(LineItem* sender) void ProjectionsEditorCanvas::setColorMap(ColorMap* colorMap) { - std::cout<<"DEBG ProjectionsEditorCanvas::setColorMap"<<std::endl; + std::cout << "DEBG ProjectionsEditorCanvas::setColorMap" << std::endl; ASSERT(colorMap); m_colorMap = colorMap; diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp index 35065c5e035..441b81d8e56 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp @@ -26,7 +26,7 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) : DataAccessWidget(parent) - , m_editorActions(new ProjectionActions(this)) + , m_actions(new ProjectionActions(this)) , m_projectionsCanvas(new ProjectionsEditorCanvas) , m_projectionsWidget(new ProjectionsWidget) , m_scaleEditor(new Scale2DEditor(this)) @@ -46,15 +46,15 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) m_scaleEditor->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); m_scaleEditor->setHidden(true); - auto* toolbar = new ProjectionToolbar(m_editorActions); + auto* toolbar = new ProjectionToolbar(m_actions); layout->addWidget(toolbar); //... Connections - connect(m_editorActions, &ProjectionActions::resetViewRequest, m_projectionsCanvas, + connect(m_actions, &ProjectionActions::resetViewRequest, m_projectionsCanvas, &ProjectionsEditorCanvas::onResetViewRequest, Qt::UniqueConnection); - connect(m_editorActions, &ProjectionActions::propertyPanelRequest, + connect(m_actions, &ProjectionActions::propertyPanelRequest, [this] { m_scaleEditor->setHidden(!m_scaleEditor->isHidden()); }); connect(toolbar, &ProjectionToolbar::activityChanged, m_projectionsCanvas, @@ -66,7 +66,7 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) connect(m_projectionsWidget, &ProjectionsWidget::changeActivityRequest, toolbar, &ProjectionToolbar::onProjectionTabChange, Qt::UniqueConnection); - connect(m_projectionsCanvas, &ProjectionsEditorCanvas::deleteSelectedRequest, m_editorActions, + connect(m_projectionsCanvas, &ProjectionsEditorCanvas::deleteSelectedRequest, m_actions, &ProjectionActions::onDeleteAction, Qt::UniqueConnection); connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeProjectionsTabRequest, @@ -100,7 +100,7 @@ void Plot2DWithProjectionFrame::updateProjsFrame() m_projectionsCanvas->updateProjsCanvas(currentData2DItem()); m_projectionsWidget->setData2DItem(currentData2DItem()); - m_editorActions->updateProjsActions(currentData2DItem()); + m_actions->updateProjsActions(currentData2DItem()); } void Plot2DWithProjectionFrame::showEvent(QShowEvent*) @@ -118,5 +118,5 @@ void Plot2DWithProjectionFrame::hideEvent(QHideEvent*) QList<QAction*> Plot2DWithProjectionFrame::actionList() { - return m_editorActions->topToolboxActions(); + return m_actions->topToolboxActions(); } diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.h b/GUI/View/Frame/Plot2DWithProjectionFrame.h index 687ab5fd348..08a0d40309a 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.h +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.h @@ -38,7 +38,7 @@ private: void showEvent(QShowEvent*) override; void hideEvent(QHideEvent*) override; - ProjectionActions* m_editorActions; + ProjectionActions* m_actions; ProjectionsEditorCanvas* m_projectionsCanvas; //! canvas with color map at the top ProjectionsWidget* m_projectionsWidget; //! bottom widget to draw projections plot Scale2DEditor* m_scaleEditor; //! panel at the right with properties -- GitLab From 781e896488a542106007502e05a07daedeab4fa2 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 18:09:43 +0100 Subject: [PATCH 16/28] rm unique connection --- GUI/View/Frame/Plot2DWithProjectionFrame.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp index 441b81d8e56..5855528dbca 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp @@ -52,32 +52,32 @@ Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) //... Connections connect(m_actions, &ProjectionActions::resetViewRequest, m_projectionsCanvas, - &ProjectionsEditorCanvas::onResetViewRequest, Qt::UniqueConnection); + &ProjectionsEditorCanvas::onResetViewRequest); connect(m_actions, &ProjectionActions::propertyPanelRequest, [this] { m_scaleEditor->setHidden(!m_scaleEditor->isHidden()); }); connect(toolbar, &ProjectionToolbar::activityChanged, m_projectionsCanvas, - &ProjectionsEditorCanvas::setProjectionsCanvasMode, Qt::UniqueConnection); + &ProjectionsEditorCanvas::setProjectionsCanvasMode); connect(toolbar, &ProjectionToolbar::activityChanged, m_projectionsWidget, - &ProjectionsWidget::onActivityChanged, Qt::UniqueConnection); + &ProjectionsWidget::onActivityChanged); connect(m_projectionsWidget, &ProjectionsWidget::changeActivityRequest, toolbar, - &ProjectionToolbar::onProjectionTabChange, Qt::UniqueConnection); + &ProjectionToolbar::onProjectionTabChange); connect(m_projectionsCanvas, &ProjectionsEditorCanvas::deleteSelectedRequest, m_actions, - &ProjectionActions::onDeleteAction, Qt::UniqueConnection); + &ProjectionActions::onDeleteAction); connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeProjectionsTabRequest, - m_projectionsWidget, &ProjectionsWidget::onActivityChanged, Qt::UniqueConnection); + m_projectionsWidget, &ProjectionsWidget::onActivityChanged); // space bar push (request for zoom mode) connect(m_projectionsCanvas, &ProjectionsEditorCanvas::changeActivityRequest, toolbar, - &ProjectionToolbar::onChangeActivityRequest, Qt::UniqueConnection); + &ProjectionToolbar::onChangeActivityRequest); connect(m_projectionsCanvas, &ProjectionsEditorCanvas::marginsChanged, m_projectionsWidget, - &ProjectionsWidget::onMarginsChanged, Qt::UniqueConnection); + &ProjectionsWidget::onMarginsChanged); toolbar->onChangeActivityRequest(MaskFlags::HORIZONTAL_LINE_MODE); } -- GitLab From fd5bbdd682ed5e7984d64e04b3162465141c648f Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 18:17:30 +0100 Subject: [PATCH 17/28] lambda --- GUI/View/Frame/MaskEditingFrame.cpp | 10 ++-------- GUI/View/Frame/MaskEditingFrame.h | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/GUI/View/Frame/MaskEditingFrame.cpp b/GUI/View/Frame/MaskEditingFrame.cpp index b19a4a563f5..fe9bc318ba6 100644 --- a/GUI/View/Frame/MaskEditingFrame.cpp +++ b/GUI/View/Frame/MaskEditingFrame.cpp @@ -52,8 +52,8 @@ MaskEditingFrame::MaskEditingFrame(QWidget* parent) connect(m_actions, &MaskEditorActions::resetViewRequest, m_canvas, &MaskEditorCanvas::onResetViewRequest); - connect(m_actions, &MaskEditorActions::propertyPanelRequest, this, - &MaskEditingFrame::onPropertyPanelRequest); + connect(m_actions, &MaskEditorActions::propertyPanelRequest, + [this] { m_panel->setPanelHidden(!m_panel->isHidden()); }); connect(m_actions, &MaskEditorActions::savePlotRequest, m_canvas, &MaskEditorCanvas::onSavePlotRequest); @@ -87,12 +87,6 @@ void MaskEditingFrame::setJobOrDatafileItem(QObject* item) updateMaskFrame(); } -//! shows/hides right panel with properties -void MaskEditingFrame::onPropertyPanelRequest() -{ - m_panel->setPanelHidden(!m_panel->isHidden()); -} - //! Returns list of actions intended for styled toolbox (on the top). QList<QAction*> MaskEditingFrame::actionList() diff --git a/GUI/View/Frame/MaskEditingFrame.h b/GUI/View/Frame/MaskEditingFrame.h index 89040299f12..3f716bfc4eb 100644 --- a/GUI/View/Frame/MaskEditingFrame.h +++ b/GUI/View/Frame/MaskEditingFrame.h @@ -34,7 +34,6 @@ public: private: void updateMaskFrame(); - void onPropertyPanelRequest(); void showEvent(QShowEvent*) override; void hideEvent(QHideEvent*) override; -- GitLab From 03bbaaa7500d3eea1676802ed3672e7fc5daba54 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 18:41:45 +0100 Subject: [PATCH 18/28] sort fcts --- GUI/View/Frame/MaskEditingFrame.cpp | 24 ++++++++++---------- GUI/View/Frame/Plot2DWithProjectionFrame.cpp | 10 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/GUI/View/Frame/MaskEditingFrame.cpp b/GUI/View/Frame/MaskEditingFrame.cpp index fe9bc318ba6..a4905a47bfd 100644 --- a/GUI/View/Frame/MaskEditingFrame.cpp +++ b/GUI/View/Frame/MaskEditingFrame.cpp @@ -94,18 +94,6 @@ QList<QAction*> MaskEditingFrame::actionList() return m_actions->topToolboxActions(); } -void MaskEditingFrame::showEvent(QShowEvent*) -{ - if (currentData2DItem()) - updateMaskFrame(); -} - -void MaskEditingFrame::hideEvent(QHideEvent*) -{ - m_panel->resetMaskPanel(); - m_canvas->resetMaskCanvas(); -} - void MaskEditingFrame::updateMaskFrame() { ASSERT(currentData2DItem()); @@ -121,3 +109,15 @@ void MaskEditingFrame::updateMaskFrame() update(); } + +void MaskEditingFrame::showEvent(QShowEvent*) +{ + if (currentData2DItem()) + updateMaskFrame(); +} + +void MaskEditingFrame::hideEvent(QHideEvent*) +{ + m_panel->resetMaskPanel(); + m_canvas->resetMaskCanvas(); +} diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp index 5855528dbca..95c98b58fe2 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp @@ -89,6 +89,11 @@ void Plot2DWithProjectionFrame::setJobOrDatafileItem(QObject* item) updateProjsFrame(); } +QList<QAction*> Plot2DWithProjectionFrame::actionList() +{ + return m_actions->topToolboxActions(); +} + void Plot2DWithProjectionFrame::updateProjsFrame() { ASSERT(currentData2DItem()); @@ -115,8 +120,3 @@ void Plot2DWithProjectionFrame::hideEvent(QHideEvent*) m_projectionsWidget->disconnectItem(); m_projectionsWidget->setData2DItem(nullptr); } - -QList<QAction*> Plot2DWithProjectionFrame::actionList() -{ - return m_actions->topToolboxActions(); -} -- GitLab From f034c5f32f9b6eeab6ec1815f2c38469c322114e Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 18:49:53 +0100 Subject: [PATCH 19/28] no need to disamiguate private fcts --- GUI/View/Frame/MaskEditingFrame.cpp | 6 +++--- GUI/View/Frame/MaskEditingFrame.h | 2 +- GUI/View/Frame/Plot2DWithProjectionFrame.cpp | 6 +++--- GUI/View/Frame/Plot2DWithProjectionFrame.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/GUI/View/Frame/MaskEditingFrame.cpp b/GUI/View/Frame/MaskEditingFrame.cpp index a4905a47bfd..0f1f0ffaff4 100644 --- a/GUI/View/Frame/MaskEditingFrame.cpp +++ b/GUI/View/Frame/MaskEditingFrame.cpp @@ -84,7 +84,7 @@ MaskEditingFrame::MaskEditingFrame(QWidget* parent) void MaskEditingFrame::setJobOrDatafileItem(QObject* item) { setBaseItem(item); - updateMaskFrame(); + updateFrame(); } //! Returns list of actions intended for styled toolbox (on the top). @@ -94,7 +94,7 @@ QList<QAction*> MaskEditingFrame::actionList() return m_actions->topToolboxActions(); } -void MaskEditingFrame::updateMaskFrame() +void MaskEditingFrame::updateFrame() { ASSERT(currentData2DItem()); @@ -113,7 +113,7 @@ void MaskEditingFrame::updateMaskFrame() void MaskEditingFrame::showEvent(QShowEvent*) { if (currentData2DItem()) - updateMaskFrame(); + updateFrame(); } void MaskEditingFrame::hideEvent(QHideEvent*) diff --git a/GUI/View/Frame/MaskEditingFrame.h b/GUI/View/Frame/MaskEditingFrame.h index 3f716bfc4eb..b4112de9047 100644 --- a/GUI/View/Frame/MaskEditingFrame.h +++ b/GUI/View/Frame/MaskEditingFrame.h @@ -33,7 +33,7 @@ public: QList<QAction*> actionList() override; private: - void updateMaskFrame(); + void updateFrame(); void showEvent(QShowEvent*) override; void hideEvent(QHideEvent*) override; diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp index 95c98b58fe2..1c87ac5e9c2 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp @@ -86,7 +86,7 @@ void Plot2DWithProjectionFrame::setJobOrDatafileItem(QObject* item) { setBaseItem(item); m_scaleEditor->setJobOrDatafileItem(item); - updateProjsFrame(); + updateFrame(); } QList<QAction*> Plot2DWithProjectionFrame::actionList() @@ -94,7 +94,7 @@ QList<QAction*> Plot2DWithProjectionFrame::actionList() return m_actions->topToolboxActions(); } -void Plot2DWithProjectionFrame::updateProjsFrame() +void Plot2DWithProjectionFrame::updateFrame() { ASSERT(currentData2DItem()); @@ -111,7 +111,7 @@ void Plot2DWithProjectionFrame::updateProjsFrame() void Plot2DWithProjectionFrame::showEvent(QShowEvent*) { if (currentData2DItem()) - updateProjsFrame(); + updateFrame(); } void Plot2DWithProjectionFrame::hideEvent(QHideEvent*) diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.h b/GUI/View/Frame/Plot2DWithProjectionFrame.h index 08a0d40309a..f037e074de7 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.h +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.h @@ -34,7 +34,7 @@ public: QList<QAction*> actionList() override; private: - void updateProjsFrame(); + void updateFrame(); void showEvent(QShowEvent*) override; void hideEvent(QHideEvent*) override; -- GitLab From 301fcbff0cd397ad7fef32869acc1adcb2123579 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 18:52:31 +0100 Subject: [PATCH 20/28] rm includes --- GUI/View/Frame/MaskEditingFrame.cpp | 2 +- GUI/View/Frame/Plot2DWithProjectionFrame.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/GUI/View/Frame/MaskEditingFrame.cpp b/GUI/View/Frame/MaskEditingFrame.cpp index 0f1f0ffaff4..233b7e3d38f 100644 --- a/GUI/View/Frame/MaskEditingFrame.cpp +++ b/GUI/View/Frame/MaskEditingFrame.cpp @@ -13,8 +13,8 @@ // ************************************************************************************************ #include "GUI/View/Frame/MaskEditingFrame.h" +#include "Base/Util/Assert.h" #include "GUI/Model/Data/Data2DItem.h" -#include "GUI/Model/Mask/MaskItems.h" #include "GUI/Model/Mask/MaskeditorListmodel.h" #include "GUI/View/Canvas/MaskEditorActions.h" #include "GUI/View/Canvas/MaskEditorCanvas.h" diff --git a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp index 1c87ac5e9c2..75898f32c22 100644 --- a/GUI/View/Frame/Plot2DWithProjectionFrame.cpp +++ b/GUI/View/Frame/Plot2DWithProjectionFrame.cpp @@ -15,13 +15,12 @@ #include "GUI/View/Frame/Plot2DWithProjectionFrame.h" #include "Base/Util/Assert.h" #include "GUI/Model/Data/Data2DItem.h" -#include "GUI/Model/Mask/ProjectionList.h" #include "GUI/View/Canvas/ProjectionsEditorCanvas.h" #include "GUI/View/Canvas/ProjectionsWidget.h" #include "GUI/View/Setup/ProjectionActions.h" #include "GUI/View/Setup/ProjectionToolbar.h" #include "GUI/View/Setup/Scale2DEditor.h" -#include <QBoxLayout> +#include <QHBoxLayout> #include <QSplitter> Plot2DWithProjectionFrame::Plot2DWithProjectionFrame(QWidget* parent) -- GitLab From d591dc810c2268cf65404a5ad2360f55dbf22bc7 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 20:41:39 +0100 Subject: [PATCH 21/28] sort members --- GUI/View/Canvas/MaskEditorCanvas.cpp | 7 +++---- GUI/View/Canvas/MaskEditorCanvas.h | 4 ++-- GUI/View/Canvas/ProjectionsEditorCanvas.h | 6 ++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/GUI/View/Canvas/MaskEditorCanvas.cpp b/GUI/View/Canvas/MaskEditorCanvas.cpp index b0cc258c13d..2aefc8a0bb0 100644 --- a/GUI/View/Canvas/MaskEditorCanvas.cpp +++ b/GUI/View/Canvas/MaskEditorCanvas.cpp @@ -26,12 +26,11 @@ #include <QVBoxLayout> #include <iostream> -MaskEditorCanvas::MaskEditorCanvas(QWidget* parent) - : QWidget(parent) - , m_scene(new MaskGraphicsScene) +MaskEditorCanvas::MaskEditorCanvas() + : m_scene(new MaskGraphicsScene) , m_view(new MaskGraphicsView(m_scene)) - , m_data2DItem(nullptr) , m_statusLabel(new PlotStatusLabel(nullptr, this)) + , m_data2DItem(nullptr) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); diff --git a/GUI/View/Canvas/MaskEditorCanvas.h b/GUI/View/Canvas/MaskEditorCanvas.h index 5b8a385749b..b0cf53d26ac 100644 --- a/GUI/View/Canvas/MaskEditorCanvas.h +++ b/GUI/View/Canvas/MaskEditorCanvas.h @@ -32,7 +32,7 @@ class PlotStatusLabel; class MaskEditorCanvas : public QWidget { Q_OBJECT public: - MaskEditorCanvas(QWidget* parent = nullptr); + MaskEditorCanvas(); ~MaskEditorCanvas(); void updateMaskCanvas(Data2DItem* data2DItem, QItemSelectionModel* selModel); @@ -56,8 +56,8 @@ private: MaskGraphicsScene* m_scene; MaskGraphicsView* m_view; - Data2DItem* m_data2DItem; PlotStatusLabel* m_statusLabel; + Data2DItem* m_data2DItem; std::unique_ptr<Datafield> m_backup_data; bool m_backup_interpolated = false; }; diff --git a/GUI/View/Canvas/ProjectionsEditorCanvas.h b/GUI/View/Canvas/ProjectionsEditorCanvas.h index 140f38635e3..283ad9bdca1 100644 --- a/GUI/View/Canvas/ProjectionsEditorCanvas.h +++ b/GUI/View/Canvas/ProjectionsEditorCanvas.h @@ -61,12 +61,10 @@ private: MaskGraphicsScene* m_scene; MaskGraphicsView* m_view; - ColorMap* m_colorMap; PlotStatusLabel* m_statusLabel; - - std::unique_ptr<LineItem> m_liveProjection; //!< temporary, matching mouse move Data2DItem* m_data2DItem; - + ColorMap* m_colorMap; + std::unique_ptr<LineItem> m_liveProjection; //!< temporary, matching mouse move MaskFlags::MaskMode m_currentActivity; bool m_block_update = false; }; -- GitLab From 88af21d049e7cde5d8400bf16018ce30a0dce284 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 20:42:18 +0100 Subject: [PATCH 22/28] rm include --- GUI/View/Canvas/MaskEditorCanvas.h | 1 - 1 file changed, 1 deletion(-) diff --git a/GUI/View/Canvas/MaskEditorCanvas.h b/GUI/View/Canvas/MaskEditorCanvas.h index b0cf53d26ac..374644304f2 100644 --- a/GUI/View/Canvas/MaskEditorCanvas.h +++ b/GUI/View/Canvas/MaskEditorCanvas.h @@ -17,7 +17,6 @@ #include "GUI/View/Scene/MaskFlags.h" #include <QItemSelectionModel> -#include <QModelIndex> #include <QWidget> #include <memory> -- GitLab From cb5569fca2c6843e27682ac2fe105cc6875b090e Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 20:43:11 +0100 Subject: [PATCH 23/28] rm parent --- GUI/View/Canvas/ProjectionsEditorCanvas.cpp | 5 ++--- GUI/View/Canvas/ProjectionsEditorCanvas.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/GUI/View/Canvas/ProjectionsEditorCanvas.cpp b/GUI/View/Canvas/ProjectionsEditorCanvas.cpp index fa8b959544c..801c438c2ac 100644 --- a/GUI/View/Canvas/ProjectionsEditorCanvas.cpp +++ b/GUI/View/Canvas/ProjectionsEditorCanvas.cpp @@ -27,9 +27,8 @@ #include <QVBoxLayout> #include <iostream> -ProjectionsEditorCanvas::ProjectionsEditorCanvas(QWidget* parent) - : QWidget(parent) - , m_scene(new MaskGraphicsScene) +ProjectionsEditorCanvas::ProjectionsEditorCanvas() + : m_scene(new MaskGraphicsScene) , m_view(new MaskGraphicsView(m_scene)) , m_statusLabel(new PlotStatusLabel(nullptr, this)) , m_currentActivity(MaskFlags::HORIZONTAL_LINE_MODE) diff --git a/GUI/View/Canvas/ProjectionsEditorCanvas.h b/GUI/View/Canvas/ProjectionsEditorCanvas.h index 283ad9bdca1..20e454e60f4 100644 --- a/GUI/View/Canvas/ProjectionsEditorCanvas.h +++ b/GUI/View/Canvas/ProjectionsEditorCanvas.h @@ -35,7 +35,7 @@ class PlotStatusLabel; class ProjectionsEditorCanvas : public QWidget { Q_OBJECT public: - ProjectionsEditorCanvas(QWidget* parent = nullptr); + ProjectionsEditorCanvas(); virtual ~ProjectionsEditorCanvas(); void updateProjsCanvas(Data2DItem* data2DItem); -- GitLab From 90e1833f188e0f32a760ec3103e1b564d751c298 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 20:46:06 +0100 Subject: [PATCH 24/28] privatize --- GUI/View/Canvas/ProjectionsEditorCanvas.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GUI/View/Canvas/ProjectionsEditorCanvas.h b/GUI/View/Canvas/ProjectionsEditorCanvas.h index 20e454e60f4..d3fe19c142f 100644 --- a/GUI/View/Canvas/ProjectionsEditorCanvas.h +++ b/GUI/View/Canvas/ProjectionsEditorCanvas.h @@ -48,11 +48,13 @@ signals: void marginsChanged(double left, double right); public slots: + void onResetViewRequest(); + void setProjectionsCanvasMode(MaskFlags::MaskMode mask_mode); + +private slots: void onEnteringColorMap(); void onLeavingColorMap(); void onPositionChanged(double x, double y); - void onResetViewRequest(); - void setProjectionsCanvasMode(MaskFlags::MaskMode mask_mode); private: void onLineItemMoved(LineItem* sender); -- GitLab From d4f0d9dbad5ba7e75593f130a243cfbbb78bd3e1 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 20:47:30 +0100 Subject: [PATCH 25/28] sort fcts --- GUI/View/Canvas/MaskEditorCanvas.h | 4 ++-- GUI/View/Canvas/ProjectionsEditorCanvas.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GUI/View/Canvas/MaskEditorCanvas.h b/GUI/View/Canvas/MaskEditorCanvas.h index 374644304f2..4d500ad201e 100644 --- a/GUI/View/Canvas/MaskEditorCanvas.h +++ b/GUI/View/Canvas/MaskEditorCanvas.h @@ -45,9 +45,9 @@ signals: void deleteSelectedRequest(); public slots: - void onPresentationChange(bool pixelized); - void onSavePlotRequest(); void onResetViewRequest(); + void onSavePlotRequest(); + void onPresentationChange(bool pixelized); private: void repaintScene(); diff --git a/GUI/View/Canvas/ProjectionsEditorCanvas.h b/GUI/View/Canvas/ProjectionsEditorCanvas.h index d3fe19c142f..e55f549805c 100644 --- a/GUI/View/Canvas/ProjectionsEditorCanvas.h +++ b/GUI/View/Canvas/ProjectionsEditorCanvas.h @@ -42,9 +42,9 @@ public: void resetProjsCanvas(); signals: - void changeProjectionsTabRequest(MaskFlags::MaskMode); void changeActivityRequest(MaskFlags::MaskMode); void deleteSelectedRequest(); + void changeProjectionsTabRequest(MaskFlags::MaskMode); void marginsChanged(double left, double right); public slots: -- GitLab From c0c8e9c291d347f12fc044e5341e0e5f5510e55b Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 20:53:47 +0100 Subject: [PATCH 26/28] rmvirtual --- GUI/View/Canvas/MaskEditorCanvas.h | 1 - GUI/View/Canvas/ProjectionsEditorCanvas.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/GUI/View/Canvas/MaskEditorCanvas.h b/GUI/View/Canvas/MaskEditorCanvas.h index 4d500ad201e..29230a109c9 100644 --- a/GUI/View/Canvas/MaskEditorCanvas.h +++ b/GUI/View/Canvas/MaskEditorCanvas.h @@ -35,7 +35,6 @@ public: ~MaskEditorCanvas(); void updateMaskCanvas(Data2DItem* data2DItem, QItemSelectionModel* selModel); - void resetMaskCanvas(); MaskGraphicsScene* getScene() { return m_scene; } diff --git a/GUI/View/Canvas/ProjectionsEditorCanvas.h b/GUI/View/Canvas/ProjectionsEditorCanvas.h index e55f549805c..85e1b96cbc1 100644 --- a/GUI/View/Canvas/ProjectionsEditorCanvas.h +++ b/GUI/View/Canvas/ProjectionsEditorCanvas.h @@ -36,7 +36,7 @@ class ProjectionsEditorCanvas : public QWidget { Q_OBJECT public: ProjectionsEditorCanvas(); - virtual ~ProjectionsEditorCanvas(); + ~ProjectionsEditorCanvas(); void updateProjsCanvas(Data2DItem* data2DItem); void resetProjsCanvas(); -- GitLab From d4db157acd334079400513b3b21a31b6fd30fae1 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 21:10:33 +0100 Subject: [PATCH 27/28] MaskEditorCanvas::updateMaskCanvas repaint only after setting data => mask canvas now shown from the beginning in full size --- GUI/View/Canvas/MaskEditorCanvas.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GUI/View/Canvas/MaskEditorCanvas.cpp b/GUI/View/Canvas/MaskEditorCanvas.cpp index 2aefc8a0bb0..9dd505d2819 100644 --- a/GUI/View/Canvas/MaskEditorCanvas.cpp +++ b/GUI/View/Canvas/MaskEditorCanvas.cpp @@ -54,9 +54,10 @@ void MaskEditorCanvas::updateMaskCanvas(Data2DItem* data2DItem, QItemSelectionMo std::cout << "DEBG MaskEditorCanvas::updateMaskCanvas" << std::endl; m_data2DItem = data2DItem; - repaintScene(); m_scene->associateItems(data2DItem, data2DItem->getOrCreateMaskModel(), selModel); + repaintScene(); + m_statusLabel->addPlot(m_scene->colorMap()); } -- GitLab From a8eefc2fb980c024f4851f812eb1e226480ae1f6 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 10 Jan 2024 21:11:20 +0100 Subject: [PATCH 28/28] rm debmsgs --- GUI/View/Canvas/MaskEditorCanvas.cpp | 6 ------ GUI/View/Canvas/ProjectionsEditorCanvas.cpp | 7 ------- 2 files changed, 13 deletions(-) diff --git a/GUI/View/Canvas/MaskEditorCanvas.cpp b/GUI/View/Canvas/MaskEditorCanvas.cpp index 9dd505d2819..a96619cad65 100644 --- a/GUI/View/Canvas/MaskEditorCanvas.cpp +++ b/GUI/View/Canvas/MaskEditorCanvas.cpp @@ -24,7 +24,6 @@ #include "GUI/View/Scene/MaskGraphicsScene.h" #include "GUI/View/Scene/MaskGraphicsView.h" #include <QVBoxLayout> -#include <iostream> MaskEditorCanvas::MaskEditorCanvas() : m_scene(new MaskGraphicsScene) @@ -51,7 +50,6 @@ MaskEditorCanvas::~MaskEditorCanvas() = default; void MaskEditorCanvas::updateMaskCanvas(Data2DItem* data2DItem, QItemSelectionModel* selModel) { - std::cout << "DEBG MaskEditorCanvas::updateMaskCanvas" << std::endl; m_data2DItem = data2DItem; m_scene->associateItems(data2DItem, data2DItem->getOrCreateMaskModel(), selModel); @@ -63,7 +61,6 @@ void MaskEditorCanvas::updateMaskCanvas(Data2DItem* data2DItem, QItemSelectionMo void MaskEditorCanvas::resetMaskCanvas() { - std::cout << "DEBG MaskEditorCanvas::resetMaskCanvas" << std::endl; m_data2DItem = nullptr; m_scene->dissociateItems(); m_statusLabel->reset(); @@ -71,7 +68,6 @@ void MaskEditorCanvas::resetMaskCanvas() void MaskEditorCanvas::onPresentationChange(bool pixelized) { - std::cout << "DEBG MaskEditorCanvas::onPresentationChange(" << std::endl; m_scene->clearSelection(); // important to avoid crash (unsubscribe while calling subscribers) ASSERT(m_data2DItem); @@ -103,7 +99,6 @@ void MaskEditorCanvas::onPresentationChange(bool pixelized) void MaskEditorCanvas::repaintScene() { - std::cout << "DEBG MaskEditorCanvas::repaintScene" << std::endl; m_scene->updateSize(m_view->size()); // TODO replace by proper repaint command } @@ -118,7 +113,6 @@ void MaskEditorCanvas::onSavePlotRequest() void MaskEditorCanvas::onResetViewRequest() { - std::cout << "DEBG MaskEditorCanvas::onResetViewRequest" << std::endl; m_view->onResetViewRequest(); if (m_data2DItem->isZoomed()) diff --git a/GUI/View/Canvas/ProjectionsEditorCanvas.cpp b/GUI/View/Canvas/ProjectionsEditorCanvas.cpp index 801c438c2ac..664f8b9cee7 100644 --- a/GUI/View/Canvas/ProjectionsEditorCanvas.cpp +++ b/GUI/View/Canvas/ProjectionsEditorCanvas.cpp @@ -25,7 +25,6 @@ #include "GUI/View/Scene/MaskGraphicsView.h" #include <QItemSelectionModel> #include <QVBoxLayout> -#include <iostream> ProjectionsEditorCanvas::ProjectionsEditorCanvas() : m_scene(new MaskGraphicsScene) @@ -55,7 +54,6 @@ ProjectionsEditorCanvas::~ProjectionsEditorCanvas() = default; void ProjectionsEditorCanvas::updateProjsCanvas(Data2DItem* data2DItem) { - std::cout << "DEBG ProjectionsEditorCanvas::updateProjsCanvas" << std::endl; MaskeditorListmodel* mask_list_model = data2DItem->getOrCreateProjectionModel(); ASSERT(mask_list_model); @@ -81,7 +79,6 @@ void ProjectionsEditorCanvas::updateProjsCanvas(Data2DItem* data2DItem) void ProjectionsEditorCanvas::resetProjsCanvas() { - std::cout << "DEBG ProjectionsEditorCanvas::resetProjsCanvas" << std::endl; setConnected(false); m_data2DItem = nullptr; m_colorMap = nullptr; @@ -90,7 +87,6 @@ void ProjectionsEditorCanvas::resetProjsCanvas() void ProjectionsEditorCanvas::onEnteringColorMap() { - std::cout << "DEBG ProjectionsEditorCanvas::onEnteringColorMap" << std::endl; if (m_liveProjection || m_block_update) return; @@ -146,7 +142,6 @@ void ProjectionsEditorCanvas::onPositionChanged(double x, double y) void ProjectionsEditorCanvas::onResetViewRequest() { - std::cout << "DEBG ProjectionsEditorCanvas::onResetViewRequest" << std::endl; m_view->onResetViewRequest(); m_data2DItem->resetView(); gDoc->setModified(); @@ -154,7 +149,6 @@ void ProjectionsEditorCanvas::onResetViewRequest() void ProjectionsEditorCanvas::setProjectionsCanvasMode(MaskFlags::MaskMode mask_mode) { - std::cout << "DEBG ProjectionsEditorCanvas::setProjectionsCanvasMode" << std::endl; m_currentActivity = mask_mode; m_scene->onActivityChanged(mask_mode); onLeavingColorMap(); @@ -172,7 +166,6 @@ void ProjectionsEditorCanvas::onLineItemMoved(LineItem* sender) void ProjectionsEditorCanvas::setColorMap(ColorMap* colorMap) { - std::cout << "DEBG ProjectionsEditorCanvas::setColorMap" << std::endl; ASSERT(colorMap); m_colorMap = colorMap; -- GitLab