RAction
Class in Core Module
Header: #include <src/core/RAction.h>
Inherited by: RActionAdapter, RScriptAction
Description
Section titled “Description”Abstract base class for all action classes.
Action classes handle user interaction with a document. A menu, toolbar button or command usually triggers an action.
Scriptable: This class is available in script environments.
Public Types
Section titled “Public Types”| enum | ClickMode { PickCoordinate, PickCoordinateNoSnap, PickEntity, PickingDisabled }Current mouse click mode. |
Public Functions
Section titled “Public Functions”RAction(RGuiAction *guiAction=NULL) |
|
| virtual | ~RAction() |
| virtual void | applyOperation()=0 = 0 |
| virtual void | beginEvent()=0 = 0Called as soon as the action is created (menu chosen, toolbutton activated, etc). |
| virtual void | commandEvent(RCommandEvent &event)=0 = 0Called when a command is entered in the command line. |
| virtual void | commandEventPreview(RCommandEvent &event)=0 = 0Called when a command is being edited in the command line. |
| virtual void | coordinateEvent(RCoordinateEvent &event)=0 = 0Called for every coordinate event. |
| virtual void | coordinateEventPreview(RCoordinateEvent &event)=0 = 0Called if the action is in PickCoordinate mode and the mouse is moved around. |
| virtual void | enterEvent()=0 = 0Called when user presses enter (e.g. |
| virtual void | entityPickEvent(REntityPickEvent &event)=0 = 0 |
| virtual void | entityPickEventPreview(REntityPickEvent &event)=0 = 0 |
| virtual void | escapeEvent()=0 = 0Escape events are triggered if the user clicks the right mouse button or hits the Escape key. |
| virtual void | finishEvent()=0 = 0Called just before the action is deleted. |
| RAction::ClickMode | getClickMode() |
| virtual RDocument * | getDocument() |
| virtual RDocumentInterface * | getDocumentInterface() |
| QList< RGraphicsScene * > | getGraphicsScenes() |
| virtual RGuiAction * | getGuiAction() |
| RAction * | getOverrideBase() |
| virtual int | getState()=0 = 0 |
| RStorage * | getStorage() |
| QString | getUniqueGroup() |
| bool | hasNoState() |
| bool | isOverride() |
| bool | isTerminated() |
| virtual void | keyPressEvent(QKeyEvent &event)=0 = 0 |
| virtual void | keyReleaseEvent(QKeyEvent &event)=0 = 0 |
| virtual void | mouseDoubleClickEvent(RMouseEvent &event)=0 = 0Called on mouse double click events. |
| virtual void | mouseMoveEvent(RMouseEvent &event)=0 = 0Called on mouse move events. |
| virtual void | mousePressEvent(RMouseEvent &event)=0 = 0Called on mouse press events. |
| virtual void | mouseReleaseEvent(RMouseEvent &event)=0 = 0Called on mouse release events. |
| virtual void | panGestureEvent(QPanGesture &gesture)=0 = 0Called on pan gesture events. |
| virtual void | pinchGestureEvent(QPinchGesture &gesture)=0 = 0Called on pinch gesture events. |
| virtual void | propertyChangeEvent(RPropertyEvent &event)=0 = 0Called when the value of a property is modified while this action is active. |
| virtual void | resumeEvent()=0 = 0Resumes the action (for example when another action became active and then terminated or if the mouse cursor enters the view). |
| void | setClickMode(RAction::ClickMode m)Sets the current click mode. |
| virtual void | setDocumentInterface(RDocumentInterface *di) |
| virtual void | setGraphicsView(RGraphicsView *view)=0 = 0Called if this action is set as a navigation action of a graphics view. |
| void | setGuiAction(RGuiAction *guiAction) |
| void | setNoState(bool on=true) |
| void | setOverride() |
| void | setOverrideBase(RAction *base) |
| void | setUniqueGroup(const QString &ug) |
| virtual RVector | snap(RMouseEvent &event, bool preview=false)Uses the currently active snap function to snap to the closest object or grid point. |
| virtual void | suspendEvent()=0 = 0Called when the action is suspended, for example when another action becomes active or the mouse cursor leaves the view. |
| virtual void | swipeGestureEvent(QSwipeGesture &gesture)=0 = 0Called on swipe gesture events. |
| virtual void | tabletEvent(RTabletEvent &event)=0 = 0Called on tablet events. |
| void | terminate()Terminates the action. |
| virtual void | updatePreview()=0 = 0 |
| virtual void | wheelEvent(RWheelEvent &event)=0 = 0Called on mouse wheel events. |
| virtual void | zoomChangeEvent(RGraphicsView &view)=0 = 0Called when the zoom factor or offset changed in the given view. |
Protected Attributes
Section titled “Protected Attributes”| RAction::ClickMode | clickMode |
| RDocumentInterface * | documentInterface |
| RGuiAction * | guiAction |
| bool | noState Indicates whether this action is stateless (i.e. |
| bool | override |
| RAction * | overrideBase |
| bool | terminated |
| QString | uniqueGroup |
Member Documentation
Section titled “Member Documentation”ClickMode
Section titled “ClickMode”enum ClickModeCurrent mouse click mode.
| Value | Description |
|---|---|
PickCoordinate |
Mouse click will pick a coordinate and trigger coordinateEvent. This is the default mode. |
PickCoordinateNoSnap |
|
PickEntity |
Mouse click will pick an entity and trigger entityPickEvent. |
PickingDisabled |
Mouse click will not trigger any events except for mousePressEvent and mouseReleaseEvent. |
RAction
Section titled “RAction”RAction::RAction(RGuiAction *guiAction=NULL)All rights reserved.
This file is part of the QCAD project.
QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with QCAD.
~RAction
Section titled “~RAction”virtual RAction::~RAction()virtual
applyOperation
Section titled “applyOperation”virtual void RAction::applyOperation()=0 = 0pure virtual
Reimplemented in applyOperation.
beginEvent
Section titled “beginEvent”virtual void RAction::beginEvent()=0 = 0pure virtual
Called as soon as the action is created (menu chosen, toolbutton activated, etc).
Reimplemented in beginEvent.
commandEvent
Section titled “commandEvent”virtual void RAction::commandEvent(RCommandEvent &event)=0 = 0pure virtual
Called when a command is entered in the command line.
Reimplemented in commandEvent.
commandEventPreview
Section titled “commandEventPreview”virtual void RAction::commandEventPreview(RCommandEvent &event)=0 = 0pure virtual
Called when a command is being edited in the command line.
Reimplemented in commandEventPreview.
coordinateEvent
Section titled “coordinateEvent”virtual void RAction::coordinateEvent(RCoordinateEvent &event)=0 = 0pure virtual
Called for every coordinate event.
Coordinate events can be the result of a mouse click or an entered coordinate from the command line. These events are fired after mouse click events in mode “PickCoordinate”.
Reimplemented in coordinateEvent.
coordinateEventPreview
Section titled “coordinateEventPreview”virtual void RAction::coordinateEventPreview(RCoordinateEvent &event)=0 = 0pure virtual
Called if the action is in PickCoordinate mode and the mouse is moved around.
Typically, some sort of preview is shown to the user to indicate what would happen if that coordinate would be picked.
Reimplemented in coordinateEventPreview.
enterEvent
Section titled “enterEvent”virtual void RAction::enterEvent()=0 = 0pure virtual
Called when user presses enter (e.g.
to show action dialog with options).
Reimplemented in enterEvent.
entityPickEvent
Section titled “entityPickEvent”virtual void RAction::entityPickEvent(REntityPickEvent &event)=0 = 0pure virtual
Reimplemented in entityPickEvent.
entityPickEventPreview
Section titled “entityPickEventPreview”virtual void RAction::entityPickEventPreview(REntityPickEvent &event)=0 = 0pure virtual
Reimplemented in entityPickEventPreview.
escapeEvent
Section titled “escapeEvent”virtual void RAction::escapeEvent()=0 = 0pure virtual
Escape events are triggered if the user clicks the right mouse button or hits the Escape key.
The action is expected to go one step back, to the last state or terminate itself.
Reimplemented in escapeEvent.
finishEvent
Section titled “finishEvent”virtual void RAction::finishEvent()=0 = 0pure virtual
Called just before the action is deleted.
Reimplemented in finishEvent.
getClickMode
Section titled “getClickMode”RAction::ClickMode RAction::getClickMode()inline
Returns: The current click mode of this action as previously requested by the action.
getDocument
Section titled “getDocument”virtual RDocument * RAction::getDocument()virtual
Returns: Pointer to the graphics document or NULL if no document is open.
getDocumentInterface
Section titled “getDocumentInterface”virtual RDocumentInterface * RAction::getDocumentInterface()virtual
Returns: Reference to the document interface that owns this action or NULL for actions that run on an application level (e.g. file - new).
getGraphicsScenes
Section titled “getGraphicsScenes”QList< RGraphicsScene * > RAction::getGraphicsScenes()Returns: List of pointers to the graphics scenes which are attached to the document interface in which this action is active.
getGuiAction
Section titled “getGuiAction”virtual RGuiAction * RAction::getGuiAction()virtual
Returns: The GUI action which can be used to trigger this action or NULL.
getOverrideBase
Section titled “getOverrideBase”RAction * RAction::getOverrideBase()getState
Section titled “getState”virtual int RAction::getState()=0 = 0pure virtual
Reimplemented in getState.
getStorage
Section titled “getStorage”RStorage * RAction::getStorage()Returns: Pointer to the storage or NULL if no document is open.
getUniqueGroup
Section titled “getUniqueGroup”QString RAction::getUniqueGroup()hasNoState
Section titled “hasNoState”bool RAction::hasNoState()isOverride
Section titled “isOverride”bool RAction::isOverride()isTerminated
Section titled “isTerminated”bool RAction::isTerminated()Returns: True if the action is terminated and can be deleted, false otherwise.
keyPressEvent
Section titled “keyPressEvent”virtual void RAction::keyPressEvent(QKeyEvent &event)=0 = 0pure virtual
Reimplemented in keyPressEvent.
keyReleaseEvent
Section titled “keyReleaseEvent”virtual void RAction::keyReleaseEvent(QKeyEvent &event)=0 = 0pure virtual
Reimplemented in keyReleaseEvent.
mouseDoubleClickEvent
Section titled “mouseDoubleClickEvent”virtual void RAction::mouseDoubleClickEvent(RMouseEvent &event)=0 = 0pure virtual
Called on mouse double click events.
Reimplemented in mouseDoubleClickEvent.
mouseMoveEvent
Section titled “mouseMoveEvent”virtual void RAction::mouseMoveEvent(RMouseEvent &event)=0 = 0pure virtual
Called on mouse move events.
Reimplemented in mouseMoveEvent, mouseMoveEvent.
mousePressEvent
Section titled “mousePressEvent”virtual void RAction::mousePressEvent(RMouseEvent &event)=0 = 0pure virtual
Called on mouse press events.
Reimplemented in mousePressEvent, mousePressEvent.
mouseReleaseEvent
Section titled “mouseReleaseEvent”virtual void RAction::mouseReleaseEvent(RMouseEvent &event)=0 = 0pure virtual
Called on mouse release events.
Reimplemented in mouseReleaseEvent, mouseReleaseEvent.
panGestureEvent
Section titled “panGestureEvent”virtual void RAction::panGestureEvent(QPanGesture &gesture)=0 = 0pure virtual
Called on pan gesture events.
Reimplemented in panGestureEvent.
pinchGestureEvent
Section titled “pinchGestureEvent”virtual void RAction::pinchGestureEvent(QPinchGesture &gesture)=0 = 0pure virtual
Called on pinch gesture events.
Reimplemented in pinchGestureEvent.
propertyChangeEvent
Section titled “propertyChangeEvent”virtual void RAction::propertyChangeEvent(RPropertyEvent &event)=0 = 0pure virtual
Called when the value of a property is modified while this action is active.
Reimplemented in propertyChangeEvent.
resumeEvent
Section titled “resumeEvent”virtual void RAction::resumeEvent()=0 = 0pure virtual
Resumes the action (for example when another action became active and then terminated or if the mouse cursor enters the view).
Reimplemented in resumeEvent.
setClickMode
Section titled “setClickMode”void RAction::setClickMode(RAction::ClickMode m)Sets the current click mode.
See also: ClickMode
setDocumentInterface
Section titled “setDocumentInterface”virtual void RAction::setDocumentInterface(RDocumentInterface *di)virtual inline
setGraphicsView
Section titled “setGraphicsView”virtual void RAction::setGraphicsView(RGraphicsView *view)=0 = 0pure virtual
Called if this action is set as a navigation action of a graphics view.
Reimplemented in setGraphicsView.
setGuiAction
Section titled “setGuiAction”void RAction::setGuiAction(RGuiAction *guiAction)setNoState
Section titled “setNoState”void RAction::setNoState(bool on=true)setOverride
Section titled “setOverride”void RAction::setOverride()setOverrideBase
Section titled “setOverrideBase”void RAction::setOverrideBase(RAction *base)setUniqueGroup
Section titled “setUniqueGroup”void RAction::setUniqueGroup(const QString &ug)virtual RVector RAction::snap(RMouseEvent &event, bool preview=false)virtual
Uses the currently active snap function to snap to the closest object or grid point.
suspendEvent
Section titled “suspendEvent”virtual void RAction::suspendEvent()=0 = 0pure virtual
Called when the action is suspended, for example when another action becomes active or the mouse cursor leaves the view.
Reimplemented in suspendEvent.
swipeGestureEvent
Section titled “swipeGestureEvent”virtual void RAction::swipeGestureEvent(QSwipeGesture &gesture)=0 = 0pure virtual
Called on swipe gesture events.
Reimplemented in swipeGestureEvent.
tabletEvent
Section titled “tabletEvent”virtual void RAction::tabletEvent(RTabletEvent &event)=0 = 0pure virtual
Called on tablet events.
Reimplemented in tabletEvent.
terminate
Section titled “terminate”void RAction::terminate()Terminates the action.
The action object will be deleted after calling this method.
updatePreview
Section titled “updatePreview”virtual void RAction::updatePreview()=0 = 0pure virtual
Reimplemented in updatePreview.
wheelEvent
Section titled “wheelEvent”virtual void RAction::wheelEvent(RWheelEvent &event)=0 = 0pure virtual
Called on mouse wheel events.
Reimplemented in wheelEvent.
zoomChangeEvent
Section titled “zoomChangeEvent”virtual void RAction::zoomChangeEvent(RGraphicsView &view)=0 = 0pure virtual
Called when the zoom factor or offset changed in the given view.
Reimplemented in zoomChangeEvent.
clickMode
Section titled “clickMode”RAction::ClickMode RAction::clickModeprotected
documentInterface
Section titled “documentInterface”RDocumentInterface* RAction::documentInterfaceprotected
guiAction
Section titled “guiAction”RGuiAction* RAction::guiActionprotected
noState
Section titled “noState”bool RAction::noStateprotected
Indicates whether this action is stateless (i.e.
terminates in beginEvent).
override
Section titled “override”bool RAction::overrideprotected
overrideBase
Section titled “overrideBase”RAction* RAction::overrideBaseprotected
terminated
Section titled “terminated”bool RAction::terminatedprotected
uniqueGroup
Section titled “uniqueGroup”QString RAction::uniqueGroupprotected