diff --git a/GUI/View/SampleDesigner/ActionFactory.cpp b/GUI/View/SampleDesigner/ActionFactory.cpp index 057d42f8653ae4a75cea20f4fbb36c30bbe0c4e6..4bf3093e3f9bae7a457dc607788a64bfbab3bf1d 100644 --- a/GUI/View/SampleDesigner/ActionFactory.cpp +++ b/GUI/View/SampleDesigner/ActionFactory.cpp @@ -29,3 +29,18 @@ QAction* ActionFactory::createRemoveAction(QObject* parent, const QString& what, return removeAction; } + +QAction* ActionFactory::createShowInRealSpaceAction(QObject* parent, const QString& what, + std::function<void()> slot) +{ + auto* action = new QAction(parent); + action->setText("Show in Real Space (3D) view"); + action->setIcon(QIcon(":/SampleDesigner/images/rotate-3d.svg")); + action->setIconText("3D"); + action->setToolTip("Show " + what + " in Real Space (3D) view"); + + if (slot) + QObject::connect(action, &QAction::triggered, slot); + + return action; +} diff --git a/GUI/View/SampleDesigner/ActionFactory.h b/GUI/View/SampleDesigner/ActionFactory.h index 3315e4f7cd3d22f6e63907e6e9f8c814eb4f86c4..5237b1e593ba0f722d5c4325bd989e8f1b679482 100644 --- a/GUI/View/SampleDesigner/ActionFactory.h +++ b/GUI/View/SampleDesigner/ActionFactory.h @@ -32,11 +32,18 @@ public: //! Create "remove" action. //! - //! The "what text will be used in the tooltip, appended to "Remove ". + //! The "what" text will be used in the tooltip, appended to "Remove ". //! If a slot is given, it will be connected to the "triggered" signal. static QAction* createRemoveAction(QObject* parent, const QString& what, std::function<void()> slot = nullptr); + //! Create "show in RealSpace" action. + //! + //! The "what" text will be used in the tooltip. + //! If a slot is given, it will be connected to the "triggered" signal. + static QAction* createShowInRealSpaceAction(QObject* parent, const QString& what, + std::function<void()> slot = nullptr); + private: ActionFactory() = default; };