QCAD
Open Source 2D CAD
RAction Class Referenceabstract

Abstract base class for all action classes. More...

#include <RAction.h>

Inheritance diagram for RAction:
RActionAdapter RScriptAction DefaultNavigation EAction RNavigationAction Batch2Pdf Block BlockExamples ChangeFontToArial CommandLine CommandLineExamples ConvertUnit Counter Cross DefaultAction DevDebug Dimension Draw DrawBasedOnRectanglePP DrawBasedOnRectangleSize DrawBasedOnThreeCircles DrawBoundingBox DrawExamples EcmaScriptShell Edit ExDirListing ExExportListener ExLineDove ExMandelbrot ExMinimal ExMinimal2 ExThreePoints ExWidget ExXmlExport ExXmlImport File FlipHorizontal FlipVertical FlushBackLog HatchFromSelection Help ImportPoints Information InputPreferences IOExamples LanguagePreferences Layer LayerCompatibility LayerExamples LayerList LineBoxJoint LineDove LineRadicalAxis ListenerExamples MathExamples MenusAndToolBars Misc MiscModify Modify ModifyExamples MyScripts Nesting NestingQuantity Offset PointPole PolylineBreakSymbol PropertyEditor QtExamples ReloadLinetypes Reset RunScript ScMirrored ScPrepare Select SelectByColor SelectByHandle ShowToolDialog Snap SnapXManual SnapYManual StatusBar TextPreferences ThemePreferences ToolBarPreferences UiPreferences View Widgets Window Zoom

Public Types

enum  ClickMode { PickCoordinate, PickCoordinateNoSnap, PickEntity, PickingDisabled }
 Current mouse click mode. More...
 

Public Member Functions

virtual void applyOperation ()=0
 
virtual void beginEvent ()=0
 Called as soon as the action is created (menu chosen, toolbutton activated, etc). More...
 
virtual void commandEvent (RCommandEvent &event)=0
 Called when a command is entered in the command line. More...
 
virtual void commandEventPreview (RCommandEvent &event)=0
 Called when a command is being edited in the command line. More...
 
virtual void coordinateEvent (RCoordinateEvent &event)=0
 Called for every coordinate event. More...
 
virtual void coordinateEventPreview (RCoordinateEvent &event)=0
 Called if the action is in PickCoordinate mode and the mouse is moved around. More...
 
virtual void enterEvent ()=0
 Called when user presses enter (e.g. More...
 
virtual void entityPickEvent (REntityPickEvent &event)=0
 
virtual void entityPickEventPreview (REntityPickEvent &event)=0
 
virtual void escapeEvent ()=0
 Escape events are triggered if the user clicks the right mouse button or hits the Escape key. More...
 
virtual void finishEvent ()=0
 Called just before the action is deleted. More...
 
RAction::ClickMode getClickMode ()
 
RDocumentgetDocument ()
 
RDocumentInterfacegetDocumentInterface ()
 
QList< RGraphicsScene * > getGraphicsScenes ()
 
virtual RGuiActiongetGuiAction ()
 
RActiongetOverrideBase ()
 
RStoragegetStorage ()
 
QString getUniqueGroup ()
 
bool hasNoState ()
 
bool isOverride ()
 
bool isTerminated ()
 
virtual void keyPressEvent (QKeyEvent &event)=0
 
virtual void keyReleaseEvent (QKeyEvent &event)=0
 
virtual void mouseDoubleClickEvent (RMouseEvent &event)=0
 Called on mouse double click events. More...
 
virtual void mouseMoveEvent (RMouseEvent &event)=0
 Called on mouse move events. More...
 
virtual void mousePressEvent (RMouseEvent &event)=0
 Called on mouse press events. More...
 
virtual void mouseReleaseEvent (RMouseEvent &event)=0
 Called on mouse release events. More...
 
virtual void panGestureEvent (QPanGesture &gesture)=0
 Called on pan gesture events. More...
 
virtual void pinchGestureEvent (QPinchGesture &gesture)=0
 Called on pinch gesture events. More...
 
virtual void propertyChangeEvent (RPropertyEvent &event)=0
 Called when the value of a property is modified while this action is active. More...
 
 RAction (RGuiAction *guiAction=NULL)
 Copyright (c) 2011-2018 by Andrew Mustun. More...
 
virtual void resumeEvent ()=0
 Resumes the action (for example when another action became active and then terminated or if the mouse cursor enters the view). More...
 
void setClickMode (RAction::ClickMode m)
 Sets the current click mode. More...
 
void setDocumentInterface (RDocumentInterface *di)
 
virtual void setGraphicsView (RGraphicsView *view)=0
 Called if this action is set as a navigation action of a graphics view. More...
 
void setGuiAction (RGuiAction *guiAction)
 
void setNoState (bool on=true)
 
void setOverride ()
 
void setOverrideBase (RAction *base)
 
void setUniqueGroup (const QString &ug)
 
RVector snap (RMouseEvent &event)
 Uses the currently active snap function to snap to the closest object or grid point. More...
 
virtual void suspendEvent ()=0
 Called when the action is suspended, for example when another action becomes active or the mouse cursor leaves the view. More...
 
virtual void swipeGestureEvent (QSwipeGesture &gesture)=0
 Called on swipe gesture events. More...
 
virtual void tabletEvent (RTabletEvent &event)=0
 Called on tablet events. More...
 
void terminate ()
 Terminates the action. More...
 
virtual void updatePreview ()=0
 
virtual void wheelEvent (RWheelEvent &event)=0
 Called on mouse wheel events. More...
 
virtual void zoomChangeEvent (RGraphicsView &view)=0
 Called when the zoom factor or offset changed in the given view. More...
 
virtual ~RAction ()
 

Protected Attributes

RAction::ClickMode clickMode
 
RDocumentInterfacedocumentInterface
 
RGuiActionguiAction
 
bool noState
 Indicates whether this action is stateless (i.e. More...
 
bool override
 
RActionoverrideBase
 
bool terminated
 
QString uniqueGroup
 

Detailed 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:\nThis class is available in script environments.\n

Member Enumeration Documentation

◆ ClickMode

Current mouse click mode.

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

Constructor & Destructor Documentation

◆ RAction()

RAction::RAction ( RGuiAction guiAction = NULL)

Copyright (c) 2011-2018 by Andrew Mustun.

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

RAction::~RAction ( )
virtual

Member Function Documentation

◆ applyOperation()

virtual void RAction::applyOperation ( )
pure virtual

◆ beginEvent()

virtual void RAction::beginEvent ( )
pure virtual

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

Implemented in EAction, Print, PropertyEditor, BlockList, AbstractPreferences, Dimension, RActionAdapter, LayerList, Projection, Stretch, InsertBlockItem, Information, InfoArcCircleArea, DefaultNavigation, Leader, ExRegisterFileExporter, ScMirrored, BreakOutManual, BreakOut, Nesting, DimRadial, Line, File, FlexPainter, Select, SnapCoordinate, DevDebug, Counter, CommandLine, Bevel, IsometricGridTop, Explode, FlipHorizontal, Scale, PanZoom, LibraryBrowser, CreateLibraryItem, DrawBasedOnRectanglePP, Image, ClipboardOperation, PolylineBreakSymbol, RestrictAngleLength, SnapDistance, ArcTPR, DimDiametric, DrawBasedOnRectangleSize, Shape, Layer, WindowZoom, CheckForUpdates, ToFront, Block, DefaultAction, LineOrthogonalTangent, DrawingPreferences, Esc, BitmapExport, RecentFiles, SvgImport, BrowseUserManual, FAQ, Forum, ReportBug, ReportTranslationError, ShowReadme, Website, MolImport, MenusAndToolBars, MyAction, PersistentWidgets, ToBack, FlipVertical, Modify, CommandLineFocus, DisplayDistanceAngle, OptionsToolBarFocus, ToolMatrixFocus, AutoZoom, PreviousView, ZoomIn, ZoomOut, ZoomToSelection, CloseAll, NextWindow, PreviousWindow, Arc2PR, DimAngular, DrawBasedOnThreeCircles, HatchFromSelection, Line2P, LineTangent2, LineDove, DrawPolyline, InfoPolylineArea, LineBoxJoint, Translate, SelectContour, SnapIntersectionManual, AntialiasingMode, DraftMode, Arc2PA, Arc2PH, Circle3T, Hatch, ExRegisterFileImporter, LineRadicalAxis, EditText, Offset, Rotate, Trim, Arc, Circle, Point, Polyline, Spline, Text, Edit, About, InfoDistanceEE, Misc, TextAlong, EditHatch, Rotate2, Snap, View, Zoom, Circle2P, Ellipse, EllipseInscribedQuad, Lengthen, Circle3P, Divide, SelectIntersectedEntities, SnapMiddleManual, SnapXManual, EditFromReference, Arc2PL, ArcTangential, Circle2PR, EllipseArcCPPA, LineRelativeAngle, ShapeRectanglePP, ImportFile, EditLayer, ExAddBlock, ExMandelbrot, Mirror, BlockInsert, LineAngle, LineFreehand, ShapePolygonCP, ShapePolygonPP, NewFile, InfoAngle, InfoDistanceEP, ExDrawColors, ExMathSpiral, EcmaScriptShell, PointPole, ArcCPA, Circle2TR, CircleCP, Point1P, ShapePolygonAFPP, InfoArea, InfoDistancePP, InfoPosition, ExXmlImport, BreakOutGap, OffsetThrough, SelectLayerByEntity, SnapDistanceManual, SnapYManual, CreateBlock, InsertBlock, InsertScriptItem, Arc3P, Circle2TP, DimAligned, LineTangent1, ShapePolygonAFCP, AddLayer, SelectLayer, ExLineDove, ExTransactionListener, BlockFixNames, DrawBoundingBox, SelectByColor, SnapCoordinatePolar, ToggleGrid, AddBlock, RenameBlock, LineVertical, SplineControlPoints, ConvertUnit, Delete, Duplicate, Paste, DeselectLayer, HideAllLayers, LockAllLayers, ShowAllLayers, ToggleLayerLock, ToggleLayerVisibility, UnlockAllLayers, ExThreePoints, ExDumpPolyline, ExXmlExport, ExDirListing, ExResizeWindow, Cross, ImportPoints, SelectByHandle, IsometricProjection, DeselectAll, SelectAll, SelectRectangle, LockRelativeZero, SetRelativeZero, DeselectBlockReferences, EditBlock, EditMainDrawing, HideAllBlocks, RemoveBlock, SelectBlockReferences, ShowAllBlocks, ToggleBlockVisibility, CircleT2P, DimOrdinate, DimRegen, DimRotated, LineBisector, LineHorizontal, Redo, Undo, OpenFile, Save, RemoveLayer, ShowActiveLayer, ExDrawFonts, ExText, ExAddLayer, ExLayerCustomProperty, ExMainWindow, ExProcess, ExWidget, BlockListAttributes, BlockListExport, RunScript, ModifyCorner, Reverse, TrimBoth, NestingQuantity, InvertSelection, RestrictHorizontal, RestrictOff, RestrictOrthogonal, RestrictVertical, SnapAuto, SnapCenter, SnapEnd, SnapFree, SnapGrid, SnapIntersection, SnapMiddle, SnapOnEntity, SnapPerpendicular, SnapReference, SnapSelectionCenter, SnapTangential, PrintCurrentView, ExDeleteObject, Reset, CloseFile, PdfExport, SaveAs, ChangeFontToArial, FlushBackLog, ReloadLinetypes, SplineToLine, ScPrepare, StatusBar, LinetypeMode, Batch2Pdf, ExMinimal, and ExMinimal2.

◆ commandEvent()

virtual void RAction::commandEvent ( RCommandEvent event)
pure virtual

Called when a command is entered in the command line.

Implemented in RActionAdapter.

◆ commandEventPreview()

virtual void RAction::commandEventPreview ( RCommandEvent event)
pure virtual

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

Implemented in RActionAdapter.

◆ coordinateEvent()

virtual void RAction::coordinateEvent ( RCoordinateEvent event)
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".

Implemented in RActionAdapter.

◆ coordinateEventPreview()

virtual void RAction::coordinateEventPreview ( RCoordinateEvent event)
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.

Implemented in RActionAdapter.

◆ enterEvent()

virtual void RAction::enterEvent ( )
pure virtual

Called when user presses enter (e.g.

to show action dialog with options).

Implemented in EAction, RActionAdapter, and Nesting.

◆ entityPickEvent()

virtual void RAction::entityPickEvent ( REntityPickEvent event)
pure virtual

Implemented in RActionAdapter.

◆ entityPickEventPreview()

virtual void RAction::entityPickEventPreview ( REntityPickEvent event)
pure virtual

Implemented in RActionAdapter.

◆ escapeEvent()

◆ finishEvent()

◆ getClickMode()

RAction::ClickMode RAction::getClickMode ( )
inline
Returns
The current click mode of this action as previously requested by the action.

◆ getDocument()

RDocument * RAction::getDocument ( )
Returns
Pointer to the graphics document or NULL if no document is open.

◆ getDocumentInterface()

RDocumentInterface * RAction::getDocumentInterface ( )
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()

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

RGuiAction * RAction::getGuiAction ( )
virtual
Returns
The GUI action which can be used to trigger this action or NULL.

◆ getOverrideBase()

RAction * RAction::getOverrideBase ( )

◆ getStorage()

RStorage * RAction::getStorage ( )
Returns
Pointer to the storage or NULL if no document is open.

◆ getUniqueGroup()

QString RAction::getUniqueGroup ( )

◆ hasNoState()

bool RAction::hasNoState ( )

◆ isOverride()

bool RAction::isOverride ( )

◆ isTerminated()

bool RAction::isTerminated ( )
Returns
True if the action is terminated and can be deleted, false otherwise.

◆ keyPressEvent()

virtual void RAction::keyPressEvent ( QKeyEvent &  event)
pure virtual

Implemented in RActionAdapter.

◆ keyReleaseEvent()

virtual void RAction::keyReleaseEvent ( QKeyEvent &  event)
pure virtual

Implemented in RActionAdapter.

◆ mouseDoubleClickEvent()

virtual void RAction::mouseDoubleClickEvent ( RMouseEvent event)
pure virtual

Called on mouse double click events.

Implemented in RActionAdapter.

◆ mouseMoveEvent()

virtual void RAction::mouseMoveEvent ( RMouseEvent event)
pure virtual

Called on mouse move events.

Implemented in RNavigationAction, and RActionAdapter.

◆ mousePressEvent()

virtual void RAction::mousePressEvent ( RMouseEvent event)
pure virtual

Called on mouse press events.

Implemented in RNavigationAction, and RActionAdapter.

◆ mouseReleaseEvent()

virtual void RAction::mouseReleaseEvent ( RMouseEvent event)
pure virtual

Called on mouse release events.

Implemented in RNavigationAction, and RActionAdapter.

◆ panGestureEvent()

virtual void RAction::panGestureEvent ( QPanGesture &  gesture)
pure virtual

Called on pan gesture events.

Implemented in RActionAdapter.

◆ pinchGestureEvent()

virtual void RAction::pinchGestureEvent ( QPinchGesture &  gesture)
pure virtual

Called on pinch gesture events.

Implemented in RActionAdapter.

◆ propertyChangeEvent()

virtual void RAction::propertyChangeEvent ( RPropertyEvent event)
pure virtual

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

Implemented in RActionAdapter.

◆ resumeEvent()

virtual void RAction::resumeEvent ( )
pure virtual

Resumes the action (for example when another action became active and then terminated or if the mouse cursor enters the view).

Implemented in EAction, RActionAdapter, Information, DefaultAction, and CloseFile.

◆ setClickMode()

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

Sets the current click mode.

See also
ClickMode

◆ setDocumentInterface()

void RAction::setDocumentInterface ( RDocumentInterface di)
inline

◆ setGraphicsView()

virtual void RAction::setGraphicsView ( RGraphicsView view)
pure virtual

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

Implemented in RActionAdapter.

◆ setGuiAction()

void RAction::setGuiAction ( RGuiAction guiAction)

◆ setNoState()

void RAction::setNoState ( bool  on = true)

◆ setOverride()

void RAction::setOverride ( )

◆ setOverrideBase()

void RAction::setOverrideBase ( RAction base)

◆ setUniqueGroup()

void RAction::setUniqueGroup ( const QString &  ug)

◆ snap()

RVector RAction::snap ( RMouseEvent event)

Uses the currently active snap function to snap to the closest object or grid point.

◆ suspendEvent()

virtual void RAction::suspendEvent ( )
pure virtual

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

Implemented in EAction, RActionAdapter, and DefaultAction.

◆ swipeGestureEvent()

virtual void RAction::swipeGestureEvent ( QSwipeGesture &  gesture)
pure virtual

Called on swipe gesture events.

Implemented in RActionAdapter.

◆ tabletEvent()

virtual void RAction::tabletEvent ( RTabletEvent event)
pure virtual

Called on tablet events.

Implemented in RActionAdapter.

◆ terminate()

void RAction::terminate ( )

Terminates the action.

The action object will be deleted after calling this method.

◆ updatePreview()

virtual void RAction::updatePreview ( )
pure virtual

◆ wheelEvent()

virtual void RAction::wheelEvent ( RWheelEvent event)
pure virtual

Called on mouse wheel events.

Implemented in RActionAdapter.

◆ zoomChangeEvent()

virtual void RAction::zoomChangeEvent ( RGraphicsView view)
pure virtual

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

Implemented in RActionAdapter.

Member Data Documentation

◆ clickMode

RAction::ClickMode RAction::clickMode
protected

◆ documentInterface

RDocumentInterface* RAction::documentInterface
protected

◆ guiAction

RGuiAction* RAction::guiAction
protected

◆ noState

bool RAction::noState
protected

Indicates whether this action is stateless (i.e.

terminates in beginEvent).

◆ override

bool RAction::override
protected

◆ overrideBase

RAction* RAction::overrideBase
protected

◆ terminated

bool RAction::terminated
protected

◆ uniqueGroup

QString RAction::uniqueGroup
protected

The documentation for this class was generated from the following files: