1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/View/Base/SlotFactory.cpp
//! @brief Implements namespace SlotFactory.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2021
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#include "GUI/View/Base/SlotFactory.h"
QAction* SlotFactory::createRemoveSlot(QObject* parent, const QString& what,
std::function<void()> slot)
{
auto* removeAction = new QAction(parent);
removeAction->setText("Remove");
removeAction->setIcon(QIcon(":/images/delete.svg"));
removeAction->setIconText("Remove");
removeAction->setToolTip("Remove " + what);
if (slot)
QObject::connect(removeAction, &QAction::triggered, slot);
return removeAction;
}
QAction* SlotFactory::createDuplicateSlot(QObject* parent, const QString& what,
std::function<void()> slot)
{
auto* duplicateAction = new QAction(parent);
duplicateAction->setText("Duplicate");
duplicateAction->setIcon(QIcon(":/images/content-copy.svg"));
duplicateAction->setIconText("Duplicate");
duplicateAction->setToolTip("Duplicate " + what);
if (slot)
QObject::connect(duplicateAction, &QAction::triggered, slot);
return duplicateAction;
}
QAction* SlotFactory::createShowInRealspaceSlot(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(":/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;
}
|