#include <ImFusion/GUI/ViewInteraction.h>
Base class for all view interactions.
More...
Base class for all view interactions.
|
| ViewInteraction (InteractiveView &view) |
| Instantiate a new ViewInteraction that contains already basic actions for the view.
|
|
void | contextMenuCreate (QMenu &m) override |
| Create context menu entries.
|
|
virtual void | setViewActionMap (ViewActionMap *m) |
| Sets the action mapping of this view. If nullptr, will default to the global one.
|
|
virtual ViewActionMap * | viewActionMap () |
| Returns the local view action map for this view interaction, if any has been set.
|
|
void | setMouseActionSpeed (ViewActionType action, double speed) |
| Setters for the speed of a mouse (touch) action.
|
|
void | setTouchActionSpeed (ViewActionType action, double speed) |
|
double | mouseActionSpeed (ViewActionType action) const |
| Getters for the speed of a mouse (touch) action, return the default value if the action is not found in the map.
|
|
double | touchActionSpeed (ViewActionType action) const |
|
virtual bool | sceneEvent (QEvent *event)=0 |
| Handles the event and returns true if the event was handles and should not passed to other interactions.
|
|
virtual void | openContextMenu (QPoint pos, QPoint globalPos, Qt::KeyboardModifiers modifiers) |
|
virtual void | reset () |
|
void | setUseContextMenu (bool use) |
| Set if the context menu must be created or not.
|
|
bool | useContextMenu () const |
| Specifies if the view creates context menu entries or not. Default value is false.
|
|
|
void | contextMenuEvaluate (QAction *action) override |
| Evaluate action chosen in context menu or by shortcut.
|
|
virtual void | contextMenuEvaluate (QAction *) |
| Evaluate action chosen in context menu or by shortcut.
|
|
|
virtual void | keyPressEvent (QKeyEvent *event) |
| Triggers actions if the pressed key sequence matches their shortcut.
|
|
void | createActions () override |
| Creates actions shown in context menu.
|
|
|
InteractiveView & | m_view |
|
ViewActionMap * | m_viewActionMap |
| Custom mapping for this specific view. This will override the global mapping if is not nullptr.
|
|
QMap< QString, QAction * > | m_actions |
| Actions used in the context menu.
|
|
bool | m_useContextMenu = false |
| Default value is false.
|
|
|
static ViewActionMap | viewActionMapGlobal |
| Global mapping between view actions and user mouse events (only mouse and keyboard modifiers now, touch and gestures must be supported too)
|
|
|
bool | matchMappedActions (ViewActionType viewAction, Qt::MouseButton button, Qt::KeyboardModifiers modifiers) const |
| Returns true if the MouseAction defined by button and modifiers is registered for the viewAction .
|
|
virtual void | createCustomViewActionMap () |
| Must be used to override the global view action mapper This method can be overridden in order to define a custom default mapping between view actions and user mouse events Example code for the overridden method:
|
|
static bool | addMappedViewAction (ViewActionType viewAction, Qt::MouseButton button, Qt::KeyboardModifiers modifiers) |
|
static bool | removeMappedViewAction (ViewActionType viewAction, Qt::MouseButton button, Qt::KeyboardModifiers modifiers) |
| Removes mapping from viewAction to MouseAction defined by button and modifiers Returns true if removing succeeds, or false if this mapping does not exists.
|
|
static void | resetActionMapping () |
| Loads the default view interaction mapping.
|
|
static const ViewActionMap & | globalViewActionMap () |
| Const access to the global view action mapper.
|
|
static void | setGlobalViewActionMap (const ViewActionMap &map) |
| Sets the global view action map.
|
|
static bool | hasConflicts (const ViewActionMap &actionMap, std::vector< std::pair< ViewActionType, ViewActionType > > &conflictingActions) |
| Checks if the mapping defined in actionMap has any conflicts.
|
|
◆ ViewInteraction()
Instantiate a new ViewInteraction that contains already basic actions for the view.
Basic actions are {"Reset", "Hide", "Fullscreen", "Link Zoom"}.
- Note
- ViewInteraction does not self-register with view. You must call InteractiveView::setInteraction().
◆ contextMenuCreate()
void contextMenuCreate |
( |
QMenu & | m | ) |
|
|
overridevirtual |
Create context menu entries.
Reimplemented from Interaction.
◆ addMappedViewAction()
static bool addMappedViewAction |
( |
ViewActionType | viewAction, |
|
|
Qt::MouseButton | button, |
|
|
Qt::KeyboardModifiers | modifiers ) |
|
static |
Adds a mapping from viewAction
to a MouseAction defined by button
and modifiers
Returns true if adding succeeds, or false if this mapping is already exists.
◆ createCustomViewActionMap()
virtual void createCustomViewActionMap |
( |
| ) |
|
|
inlinevirtual |
Must be used to override the global view action mapper This method can be overridden in order to define a custom default mapping between view actions and user mouse events Example code for the overridden method:
void CustomInteraction::createViewActionMap()
{
clearActionMapping();
...
...
}
static bool addMappedViewAction(ViewActionType viewAction, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
@ BLEND
Changing the blend factor of a 2D view.
Definition ViewInteraction.h:33
@ WINDOW
Changing the window and level of a view.
Definition ViewInteraction.h:32
◆ setMouseActionSpeed()
Setters for the speed of a mouse (touch) action.
Note, The speed is a multiplicative value in front of the actual physical displacement of the mouse/touch action. If you are using a track-pad and want to change the scrolling speed of a 3D Slice-View or a 2D Frame-View, set the speed of SWEEPSLICE3D/SWEEPSLICE2D to the desired value
◆ createActions()
Creates actions shown in context menu.
Reimplemented from Interaction.
◆ m_viewActionMap
Initial value:
Custom mapping for this specific view. This will override the global mapping if is not nullptr.
The documentation for this class was generated from the following file:
- ImFusion/GUI/ViewInteraction.h