Skip to content
Snippets Groups Projects
Commit 98e4f937 authored by Matthias Puchner's avatar Matthias Puchner
Browse files

add method to create "show in real space" action

parent 2d13128b
No related branches found
No related tags found
1 merge request!447Real space for layer editor
......@@ -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;
}
......@@ -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;
};
......
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