SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
10 #ifndef smtk_extension_qt_qtOperationAction_h
11 #define smtk_extension_qt_qtOperationAction_h
13 #include "smtk/extension/qt/Exports.h"
15 #include "smtk/attribute/utility/Queries.h"
16 #include "smtk/operation/Operation.h"
20 #include <QWidgetAction>
25 #if defined(__VTK_WRAP__) && !defined(Q_SLOTS)
26 #define Q_DISABLE_COPY(x)
28 #define Q_SIGNALS public
50 const std::shared_ptr<smtk::operation::Manager>& operationManager,
51 const std::shared_ptr<smtk::view::Manager>& viewManager,
52 smtk::operation::Operation::Index typeIndex,
57 std::string
name()
const {
return m_operationName; }
59 smtk::operation::Operation::Index
operationIndex()
const {
return m_typeIndex; }
65 void setButtonStyle(Qt::ToolButtonStyle style);
67 static constexpr
int longPress = 200;
79 void forceStyle(Qt::ToolButtonStyle buttonStyle, ActionFunctor functor);
82 void parameterTimerElapsed();
91 void acceptDefaults();
92 void editParameters();
95 QWidget* createWidget(QWidget* parent)
override;
97 bool eventFilter(QObject* watched, QEvent* event)
override;
107 void setOperationName(
const std::string& label);
116 smtk::attribute::utility::EditableParameters m_editableParameters{
117 smtk::attribute::utility::EditableParameters::None
122 Qt::ToolButtonStyle m_style{ Qt::ToolButtonTextBesideIcon };
124 bool m_toolButton{
false };
127 #endif // smtk_extension_qt_qtOperationAction_h
QTimer m_timer
A timer used to detect long-presses/double-clicks of buttons.
Definition: qtOperationAction.h:120
std::string name() const
The label of the operation (or the operation's type-name if no label is provided).
Definition: qtOperationAction.h:57
smtk::operation::Operation::Index m_typeIndex
The operation type-index (essentially the row in m_model).
Definition: qtOperationAction.h:112
smtk::operation::Operation::Index operationIndex() const
The type-index of the operation.
Definition: qtOperationAction.h:59
Qt::ToolButtonStyle buttonStyle() const
Set/get the style of button this action creates (whether to include text, icon, or both).
Definition: qtOperationAction.h:64
A QAction for users to request an operation.
Definition: qtOperationAction.h:42
std::string m_operationName
A label for the operation.
Definition: qtOperationAction.h:114
std::function< void(qtOperationAction *)> ActionFunctor
A function that takes an operation action as its input.
Definition: qtOperationAction.h:47
QPointer< qtOperationTypeModel > m_model
The operation-type model for which this action was created.
Definition: qtOperationAction.h:110
A QAbstractListModel populated with SMTK operation types.
Definition: qtOperationTypeModel.h:97
QPointer< qtOperationTypeModel > operationModel() const
The model to which the type-index of this action applies.
Definition: qtOperationAction.h:61