Skip to content

RAction

Class in Core Module
Header: #include <src/core/RAction.h>
Inherited by: RActionAdapter, RScriptAction

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.

enum ClickMode { PickCoordinate, PickCoordinateNoSnap, PickEntity, PickingDisabled }
Current mouse click mode.
RAction(RGuiAction *guiAction=NULL)
virtual ~RAction()
virtual void applyOperation()=0 = 0
virtual void beginEvent()=0 = 0
Called as soon as the action is created (menu chosen, toolbutton activated, etc).
virtual void commandEvent(RCommandEvent &event)=0 = 0
Called when a command is entered in the command line.
virtual void commandEventPreview(RCommandEvent &event)=0 = 0
Called when a command is being edited in the command line.
virtual void coordinateEvent(RCoordinateEvent &event)=0 = 0
Called for every coordinate event.
virtual void coordinateEventPreview(RCoordinateEvent &event)=0 = 0
Called if the action is in PickCoordinate mode and the mouse is moved around.
virtual void enterEvent()=0 = 0
Called when user presses enter (e.g.
virtual void entityPickEvent(REntityPickEvent &event)=0 = 0
virtual void entityPickEventPreview(REntityPickEvent &event)=0 = 0
virtual void escapeEvent()=0 = 0
Escape events are triggered if the user clicks the right mouse button or hits the Escape key.
virtual void finishEvent()=0 = 0
Called 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 = 0
Called on mouse double click events.
virtual void mouseMoveEvent(RMouseEvent &event)=0 = 0
Called on mouse move events.
virtual void mousePressEvent(RMouseEvent &event)=0 = 0
Called on mouse press events.
virtual void mouseReleaseEvent(RMouseEvent &event)=0 = 0
Called on mouse release events.
virtual void panGestureEvent(QPanGesture &gesture)=0 = 0
Called on pan gesture events.
virtual void pinchGestureEvent(QPinchGesture &gesture)=0 = 0
Called on pinch gesture events.
virtual void propertyChangeEvent(RPropertyEvent &event)=0 = 0
Called when the value of a property is modified while this action is active.
virtual void resumeEvent()=0 = 0
Resumes 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 = 0
Called 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 = 0
Called 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 = 0
Called on swipe gesture events.
virtual void tabletEvent(RTabletEvent &event)=0 = 0
Called on tablet events.
void terminate()
Terminates the action.
virtual void updatePreview()=0 = 0
virtual void wheelEvent(RWheelEvent &event)=0 = 0
Called on mouse wheel events.
virtual void zoomChangeEvent(RGraphicsView &view)=0 = 0
Called when the zoom factor or offset changed in the given view.
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

enum ClickMode

Current 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::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.

virtual RAction::~RAction()

virtual

virtual void RAction::applyOperation()=0 = 0

pure virtual

Reimplemented in applyOperation.

virtual void RAction::beginEvent()=0 = 0

pure virtual

Called as soon as the action is created (menu chosen, toolbutton activated, etc).

Reimplemented in beginEvent.

virtual void RAction::commandEvent(RCommandEvent &event)=0 = 0

pure virtual

Called when a command is entered in the command line.

Reimplemented in commandEvent.

virtual void RAction::commandEventPreview(RCommandEvent &event)=0 = 0

pure virtual

Called when a command is being edited in the command line.

Reimplemented in commandEventPreview.

virtual void RAction::coordinateEvent(RCoordinateEvent &event)=0 = 0

pure 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.

virtual void RAction::coordinateEventPreview(RCoordinateEvent &event)=0 = 0

pure 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.

virtual void RAction::enterEvent()=0 = 0

pure virtual

Called when user presses enter (e.g.

to show action dialog with options).

Reimplemented in enterEvent.

virtual void RAction::entityPickEvent(REntityPickEvent &event)=0 = 0

pure virtual

Reimplemented in entityPickEvent.

virtual void RAction::entityPickEventPreview(REntityPickEvent &event)=0 = 0

pure virtual

Reimplemented in entityPickEventPreview.

virtual void RAction::escapeEvent()=0 = 0

pure 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.

virtual void RAction::finishEvent()=0 = 0

pure virtual

Called just before the action is deleted.

Reimplemented in finishEvent.

RAction::ClickMode RAction::getClickMode()

inline

Returns: The current click mode of this action as previously requested by the action.

virtual RDocument * RAction::getDocument()

virtual

Returns: Pointer to the graphics document or NULL if no document is open.

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).

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.

virtual RGuiAction * RAction::getGuiAction()

virtual

Returns: The GUI action which can be used to trigger this action or NULL.

RAction * RAction::getOverrideBase()

virtual int RAction::getState()=0 = 0

pure virtual

Reimplemented in getState.

RStorage * RAction::getStorage()

Returns: Pointer to the storage or NULL if no document is open.

QString RAction::getUniqueGroup()

bool RAction::hasNoState()

bool RAction::isOverride()

bool RAction::isTerminated()

Returns: True if the action is terminated and can be deleted, false otherwise.

virtual void RAction::keyPressEvent(QKeyEvent &event)=0 = 0

pure virtual

Reimplemented in keyPressEvent.

virtual void RAction::keyReleaseEvent(QKeyEvent &event)=0 = 0

pure virtual

Reimplemented in keyReleaseEvent.

virtual void RAction::mouseDoubleClickEvent(RMouseEvent &event)=0 = 0

pure virtual

Called on mouse double click events.

Reimplemented in mouseDoubleClickEvent.

virtual void RAction::mouseMoveEvent(RMouseEvent &event)=0 = 0

pure virtual

Called on mouse move events.

Reimplemented in mouseMoveEvent, mouseMoveEvent.

virtual void RAction::mousePressEvent(RMouseEvent &event)=0 = 0

pure virtual

Called on mouse press events.

Reimplemented in mousePressEvent, mousePressEvent.

virtual void RAction::mouseReleaseEvent(RMouseEvent &event)=0 = 0

pure virtual

Called on mouse release events.

Reimplemented in mouseReleaseEvent, mouseReleaseEvent.

virtual void RAction::panGestureEvent(QPanGesture &gesture)=0 = 0

pure virtual

Called on pan gesture events.

Reimplemented in panGestureEvent.

virtual void RAction::pinchGestureEvent(QPinchGesture &gesture)=0 = 0

pure virtual

Called on pinch gesture events.

Reimplemented in pinchGestureEvent.

virtual void RAction::propertyChangeEvent(RPropertyEvent &event)=0 = 0

pure virtual

Called when the value of a property is modified while this action is active.

Reimplemented in propertyChangeEvent.

virtual void RAction::resumeEvent()=0 = 0

pure 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.

void RAction::setClickMode(RAction::ClickMode m)

Sets the current click mode.

See also: ClickMode

virtual void RAction::setDocumentInterface(RDocumentInterface *di)

virtual inline

virtual void RAction::setGraphicsView(RGraphicsView *view)=0 = 0

pure virtual

Called if this action is set as a navigation action of a graphics view.

Reimplemented in setGraphicsView.

void RAction::setGuiAction(RGuiAction *guiAction)

void RAction::setNoState(bool on=true)

void RAction::setOverride()

void RAction::setOverrideBase(RAction *base)

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.

virtual void RAction::suspendEvent()=0 = 0

pure virtual

Called when the action is suspended, for example when another action becomes active or the mouse cursor leaves the view.

Reimplemented in suspendEvent.

virtual void RAction::swipeGestureEvent(QSwipeGesture &gesture)=0 = 0

pure virtual

Called on swipe gesture events.

Reimplemented in swipeGestureEvent.

virtual void RAction::tabletEvent(RTabletEvent &event)=0 = 0

pure virtual

Called on tablet events.

Reimplemented in tabletEvent.

void RAction::terminate()

Terminates the action.

The action object will be deleted after calling this method.

virtual void RAction::updatePreview()=0 = 0

pure virtual

Reimplemented in updatePreview.

virtual void RAction::wheelEvent(RWheelEvent &event)=0 = 0

pure virtual

Called on mouse wheel events.

Reimplemented in wheelEvent.

virtual void RAction::zoomChangeEvent(RGraphicsView &view)=0 = 0

pure virtual

Called when the zoom factor or offset changed in the given view.

Reimplemented in zoomChangeEvent.

RAction::ClickMode RAction::clickMode

protected

RDocumentInterface* RAction::documentInterface

protected

RGuiAction* RAction::guiAction

protected

bool RAction::noState

protected

Indicates whether this action is stateless (i.e.

terminates in beginEvent).

bool RAction::override

protected

RAction* RAction::overrideBase

protected

bool RAction::terminated

protected

QString RAction::uniqueGroup

protected