##// END OF EJS Templates
Merge branch 'develop' of...
Merge branch 'develop' of https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/SciQLop-fork into develop Conflicts: core/src/Catalogue/CatalogueController.cpp

File last commit:

r1118:f354146de80e
r1315:7185ea8182da merge
Show More
SelectionZoneAction.h
75 lines | 2.4 KiB | text/x-c | CLexer
/ gui / include / Actions / SelectionZoneAction.h
Adds a a gui controller class to manage global actions across the application.
r1111 #ifndef SCIQLOP_SELECTIONZONEACTION_H
#define SCIQLOP_SELECTIONZONEACTION_H
#include <Common/spimpl.h>
#include <QLoggingCategory>
#include <QObject>
#include <functional>
class VisualizationSelectionZoneItem;
Q_DECLARE_LOGGING_CATEGORY(LOG_SelectionZoneAction)
/**
* @brief The SelectionZoneAction class represents an action on a selection zone in the
* visualization.
*
* The action is a function that will be executed when the slot execute() is called.
*/
class SelectionZoneAction : public QObject {
Q_OBJECT
public:
/// Signature of the function associated to the action
using ExecuteFunction
= std::function<void(const QVector<VisualizationSelectionZoneItem *> &item)>;
Add a lambda in SeletionZoneAction to enable or disable the action
r1115 using EnableFunction
= std::function<bool(const QVector<VisualizationSelectionZoneItem *> &item)>;
Adds a a gui controller class to manage global actions across the application.
r1111 /**
* @param name the name of the action, displayed to the user
* @param fun the function that will be called when the action is executed
* @sa execute()
*/
explicit SelectionZoneAction(const QString &name, ExecuteFunction fun);
Put the align actions in sub menus
r1118 /**
* @param name the name of the action, displayed to the user
* @param subMenusList the list of sub menus where the action should be inserted
* @param fun the function that will be called when the action is executed
* @sa execute()
*/
explicit SelectionZoneAction(const QStringList &subMenuList, const QString &name,
ExecuteFunction fun);
Add a lambda in SeletionZoneAction to enable or disable the action
r1115 /// Sets the function which determine if the action should be enabled or disabled
void setEnableFunction(EnableFunction fun);
Add action to remove the selected zone with the "del" buttons
r1117 /// Sets the shortcut displayed by the action.
/// Note: The shortcut is only displayed and not active because it is not permanently stored
void setDisplayedShortcut(const QKeySequence &shortcut);
QKeySequence displayedShortcut() const;
Adds a a gui controller class to manage global actions across the application.
r1111 /// The name of the action
QString name() const noexcept;
Put the align actions in sub menus
r1118 /// The path in the sub menus, if any
QStringList subMenuList() const noexcept;
Adds a a gui controller class to manage global actions across the application.
r1111 public slots:
/// Executes the action
void execute(const QVector<VisualizationSelectionZoneItem *> &item);
Add a lambda in SeletionZoneAction to enable or disable the action
r1115 /// Returns true if the action is enabled
bool isEnabled(const QVector<VisualizationSelectionZoneItem *> &item);
Adds a a gui controller class to manage global actions across the application.
r1111 private:
class SelectionZoneActionPrivate;
spimpl::unique_impl_ptr<SelectionZoneActionPrivate> impl;
};
#endif // SCIQLOP_SELECTIONZONEACTION_H