QCAD
Open Source 2D CAD
EAction Class Reference

Base class for all ECMAScript based actions. More...

Inheritance diagram for EAction:
RActionAdapter RAction Block BlockExamples ChangeFontToArial CommandLine CommandLineExamples Cross DefaultAction DevDebug Dimension Draw DrawBasedOnRectanglePP DrawBasedOnRectangleSize DrawBasedOnThreeCircles DrawBoundingBox DrawExamples EcmaScriptShell Edit ExDirListing ExThreePoints ExXmlExport ExXmlImport File FlipHorizontal FlipVertical FlushBackLog Help ImportPoints Information InputPreferences IOExamples LanguagePreferences Layer LayerExamples LineBoxJoint LineDove LineRadicalAxis ListenerExamples MathExamples MenusAndToolBars Misc MiscModify Modify MyScripts Offset PointPole QtExamples ReloadLinetypes Reset ScMirrored ScPrepare Select SelectByHandle Snap SnapXManual SnapYManual StatusBar TextPreferences ToolBarPreferences View Widgets Window

Public Member Functions

void applyCommand (void event, void preview)
 High level event triggered when a command line command should be applied or previewed. More...
 
void applyOperation ()
 Applies the operation returned by this.getOperation(). More...
 
void beginEvent ()
 Called when the user starts this action by clicking a button, choosing a menu, entering a command, etc. More...
 
void commandEvent (void event)
 Default implementation. More...
 
void commandEventPreview (void event)
 Default implementation. More...
 
void coordinateEvent (void event)
 Default implementation. More...
 
void coordinateEventPreview (void event)
 Default implementation. More...
 
void createDialog (void uiFile, void parent)
 Creates a new dialog based on the given UI file with the given parent. More...
 
void createWidget (void uiFile, void parent)
 Creates a new widget based on the given UI file with the given parent. More...
 
void EAction (void guiAction)
 
void entityPickEvent (void event)
 Default implementation. More...
 
void entityPickEventPreview (void event)
 Default implementation. More...
 
void escapeEvent ()
 Called when the user presses Escape or clicks the right mouse button. More...
 
void finishEvent ()
 Called when this action is terminated. More...
 
void getAuxPreview ()
 Called by updatePreview. More...
 
void getDocumentInterface ()
 
void getGraphicsView ()
 
void getGraphicsViews ()
 
void getHighlightedEntities ()
 Called by updatePreview. More...
 
void getOperation (void preview)
 Called by updatePreview. More...
 
void getScales ()
 
void getToolTitle ()
 
void handlePreviewError ()
 Called by updatePreview. More...
 
void hideUiOptions (void saveToSettings)
 Hides the UI options of this action. More...
 
void initState ()
 Called to initialize a new state of this action. More...
 
void initUiOptions (void resume, void optionsToolBar)
 Overwrite to initialize combo boxes and other UI elements of the options tool bar. More...
 
void keyPressEvent (void event)
 Called when the user presses a key. More...
 
void keyReleaseEvent (void event)
 Called when the user releases a key. More...
 
void mouseDoubleClickEvent (void event)
 
void mousePressEvent (void event)
 Does nothing. More...
 
void mouseReleaseEvent (void event)
 
void pickCoordinate (void event, void preview)
 High level event triggered when a coordinate was specified by the user of a coordinate specification should be previewed. More...
 
void pickEntity (void event, void preview)
 High level event triggered when an entity was picked by the user or to preview picking an entity. More...
 
void propertyChangeEvent (void event)
 Allows all actions to handle property change events. More...
 
void resumeEvent ()
 Called whenver the action resumes its operation, for example after it was temporary suspended for another action. More...
 
void setArrowCursor ()
 Sets the current cursor of the current document interface (all views attached to it) to the normal arrow cursor. More...
 
void setCommandPrompt (void prompt)
 
void setCrosshairCursor ()
 Sets the current cursor of the current document interface (all views attached to it) to crosshair cursor. More...
 
void setCursor (void cursor, void name)
 
void setLeftMouseTip (void tip)
 
void setRightMouseTip (void tip)
 
void setState (void state)
 Set the state of this action. More...
 
void setUiOptions (void uiFile, void split)
 Sets the UI options toolbar content for this tool. More...
 
void showUiOptions (void resume, void restoreFromSettings)
 Shows the UI options of this action if this.uiFile is set. More...
 
void simulateMouseMoveEvent ()
 
void slotReset ()
 Called if the user clicks the reset button of an action. More...
 
void suspendEvent ()
 Called whenver the action is suspended, for example if another action is started while this action is active. More...
 
void updatePreview (void clear)
 Updates the preview based on the operation returned by getOperation and the auxiliary construction returned be getAuxPreview. More...
 
- Public Member Functions inherited from RActionAdapter
virtual void commandEvent (RCommandEvent &)
 Called when a command is entered in the command line. More...
 
virtual void commandEventPreview (RCommandEvent &)
 Called when a command is being edited in the command line. More...
 
virtual void coordinateEvent (RCoordinateEvent &)
 Called for every coordinate event. More...
 
virtual void coordinateEventPreview (RCoordinateEvent &)
 Called if the action is in PickCoordinate mode and the mouse is moved around. More...
 
virtual void entityPickEvent (REntityPickEvent &)
 
virtual void entityPickEventPreview (REntityPickEvent &)
 
virtual void keyPressEvent (QKeyEvent &)
 
virtual void keyReleaseEvent (QKeyEvent &)
 
virtual void mouseDoubleClickEvent (RMouseEvent &)
 Called on mouse double click events. More...
 
virtual void mouseMoveEvent (RMouseEvent &)
 Called on mouse move events. More...
 
virtual void mousePressEvent (RMouseEvent &)
 Called on mouse press events. More...
 
virtual void mouseReleaseEvent (RMouseEvent &)
 Called on mouse release events. More...
 
virtual void panGestureEvent (QPanGesture &)
 Called on pan gesture events. More...
 
virtual void pinchGestureEvent (QPinchGesture &)
 Called on pinch gesture events. More...
 
virtual void propertyChangeEvent (RPropertyEvent &)
 Called when the value of a property is modified while this action is active. More...
 
 RActionAdapter (RGuiAction *guiAction=NULL)
 
virtual void setGraphicsView (RGraphicsView *)
 Called if this action is set as a navigation action of a graphics view. More...
 
virtual void swipeGestureEvent (QSwipeGesture &)
 Called on swipe gesture events. More...
 
virtual void tabletEvent (RTabletEvent &)
 Called on tablet events. More...
 
virtual void wheelEvent (RWheelEvent &)
 Called on mouse wheel events. More...
 
virtual ~RActionAdapter ()
 
- Public Member Functions inherited from RAction
RAction::ClickMode getClickMode ()
 
RDocumentgetDocument ()
 
RDocumentInterfacegetDocumentInterface ()
 
QList< RGraphicsScene * > getGraphicsScenes ()
 
virtual RGuiActiongetGuiAction ()
 
RActiongetOverrideBase ()
 
RStoragegetStorage ()
 
QString getUniqueGroup ()
 
bool hasNoState ()
 
bool isOverride ()
 
bool isTerminated ()
 
 RAction (RGuiAction *guiAction=NULL)
 Copyright (c) 2011-2015 by Andrew Mustun. More...
 
void setClickMode (RAction::ClickMode m)
 Sets the current click mode. More...
 
void setDocumentInterface (RDocumentInterface *di)
 
void setGuiAction (RGuiAction *guiAction)
 
void setNoState ()
 
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...
 
void terminate ()
 Terminates the action. More...
 
virtual ~RAction ()
 

Public Attributes

int additionalOptionsToolBars
 
int delegate
 
int guiAction
 
int includeBasePath
 
int optionsToolBarEnabled
 
int relativeZeroPos
 
int settingsGroup
 
int splitUiOptions
 
int state
 
int uiFile
 

Additional Inherited Members

- Public Types inherited from RAction
enum  ClickMode { PickCoordinate, PickEntity, PickingDisabled }
 Current mouse click mode. More...
 
- Protected Attributes inherited from RAction
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

Base class for all ECMAScript based actions.

Constructor & Destructor Documentation

void EAction::EAction ( void  guiAction)
inline

Member Function Documentation

void EAction::applyCommand ( void  event,
void  preview 
)
inline

High level event triggered when a command line command should be applied or previewed.

void EAction::applyOperation ( void  )
inlinevirtual

Applies the operation returned by this.getOperation().

Reimplemented from RActionAdapter.

Reimplemented in ClipboardOperation, Reverse, and Delete.

void EAction::beginEvent ( )
inlinevirtual

Called when the user starts this action by clicking a button, choosing a menu, entering a command, etc.

Shows the GUI elements that refer to this action as checked. Displays GUI options if this.uiFile is set to a valid UI file. Displays tool help in Help Viewer if available.

Reimplemented from RActionAdapter.

Reimplemented in PropertyEditor, Print, PrintPreview, Projection, ScMirrored, ExRegisterFileExporter, Stretch, Information, NewFile, BreakOut, Rotate2, About, DevDebug, EcmaScriptShell, WindowZoom, CommandLine, Mirror, BreakOutManual, FlipHorizontal, IsometricGridTop, LibraryBrowser, SnapDistance, BitmapExport, Modify, PanZoom, CheckForUpdates, Layer, Bevel, AbstractPreferences, DrawingPreferences, Esc, File, RecentFiles, SvgImport, BrowseAddOns, BrowseUserManual, FAQ, Forum, ReportBug, ReportTranslationError, ShowReadme, Website, ExThreePoints, MolImport, MenusAndToolBars, MyAction, PersistentWidgets, Explode, FlipVertical, ToBack, ToFront, Select, AutoZoom, CommandLineFocus, DisplayDistanceAngle, OptionsToolBarFocus, PreviousView, ZoomIn, ZoomOut, ZoomToSelection, CloseAll, NextWindow, PreviousWindow, PointPole, InfoAngle, Lengthen, ClipboardOperation, Edit, Snap, AntialiasingMode, DraftMode, Misc, EditText, Translate, View, InfoPosition, SnapDistanceManual, BlockList, InfoArea, InfoDistancePP, LineRadicalAxis, Trim, SnapYManual, ImportFile, InfoArcCircleArea, EditLayer, Paste, SnapIntersectionManual, ExAddBlock, Cross, SnapMiddleManual, SelectLayer, ExDrawColors, ExRegisterFileImporter, ExMathSpiral, BlockFixNames, DrawBoundingBox, LineBoxJoint, Divide, Offset, OffsetThrough, SelectContour, RestrictAngleLength, SnapCoordinate, SnapCoordinatePolar, SnapXManual, ToggleGrid, Delete, Duplicate, InfoDistanceEP, DeselectLayer, HideAllLayers, LockAllLayers, ShowAllLayers, UnlockAllLayers, ExXmlImport, LineDove, ImportPoints, SelectByHandle, ModifyCorner, Scale, TrimBoth, DeselectAll, InvertSelection, LockRelativeZero, LayerList, Redo, Undo, OpenFile, PrintCurrentView, Save, AddLayer, RemoveLayer, ShowActiveLayer, ToggleLayerVisibility, BlockListAttributes, BlockListExport, Reverse, Rotate, IsometricProjection, SelectAll, SelectIntersectedEntities, SelectLayerByEntity, SelectRectangle, RestrictHorizontal, RestrictOff, RestrictOrthogonal, RestrictVertical, SetRelativeZero, SnapAuto, SnapCenter, SnapEnd, SnapFree, SnapGrid, SnapIntersection, SnapMiddle, SnapOnEntity, SnapPerpendicular, SnapReference, SnapSelectionCenter, PdfExport, ExDumpPolyline, ExXmlExport, ExTransactionListener, ExDirListing, ExResizeWindow, Reset, CloseFile, SaveAs, ExText, ExLayerCustomProperty, ExLayerWhiteToBlack, ExMainWindow, ExProcess, ArcChangeDirection, ChangeFontToArial, FlushBackLog, ReloadLinetypes, SplineToLine, ScPrepare, StatusBar, and LinetypeMode.

void EAction::commandEvent ( void  event)
inline

Default implementation.

Calls applyCommand(event, false)

void EAction::commandEventPreview ( void  event)
inline

Default implementation.

Calls applyCommand(event, true)

void EAction::coordinateEvent ( void  event)
inline

Default implementation.

Calls pickCoordinate(event, false)

void EAction::coordinateEventPreview ( void  event)
inline

Default implementation.

Calls pickCoordinate(event, true)

void EAction::createDialog ( void  uiFile,
void  parent 
)
inline

Creates a new dialog based on the given UI file with the given parent.

This is a helper function for WidgetFactory.createDialog.

void EAction::createWidget ( void  uiFile,
void  parent 
)
inline

Creates a new widget based on the given UI file with the given parent.

This is a helper function for WidgetFactory.createWidget.

void EAction::entityPickEvent ( void  event)
inline

Default implementation.

Calls pickEntity(event, false)

void EAction::entityPickEventPreview ( void  event)
inline

Default implementation.

Calls pickEntity(event, true)

void EAction::escapeEvent ( void  )
inlinevirtual
void EAction::finishEvent ( void  )
inlinevirtual

Called when this action is terminated.

Shows the GUI elements that refer to this action as un-checked. Hides GUI options if this.uiFile is set to a valid UI file. Clears up mouse tips, etc.

Reimplemented from RActionAdapter.

Reimplemented in PropertyEditor, PrintPreview, EcmaScriptShell, CommandLine, LibraryBrowser, PanZoom, IsometricGridTop, WindowZoom, Snap, AntialiasingMode, DraftMode, ImportFile, Transform, SnapIntersectionManual, ToggleGrid, BlockList, LockRelativeZero, PrintCurrentView, LinetypeMode, and LayerList.

void EAction::getAuxPreview ( )
inline

Called by updatePreview.

Implementations must return an array of RShape objects that should be displayed as auxiliary construction.

void EAction::getDocumentInterface ( )
inline
void EAction::getGraphicsView ( )
inline
void EAction::getGraphicsViews ( )
inline
void EAction::getHighlightedEntities ( )
inline

Called by updatePreview.

Implementations must return an array of enitity IDs which should be highlighted.

void EAction::getOperation ( void  preview)
inline

Called by updatePreview.

Implementations must return an ROperation subclass object for the operation that should be previewed.

void EAction::getScales ( )
inline
void EAction::getToolTitle ( )
inline
void EAction::handlePreviewError ( )
inline

Called by updatePreview.

Implementations must handle errors during preview.

void EAction::hideUiOptions ( void  saveToSettings)
inline

Hides the UI options of this action.

Usually this function does not need to be called directly by implementing actions.

Parameters
saveToSettingsif true, the state is saved to settings
void EAction::initState ( void  )
inline

Called to initialize a new state of this action.

Overwrite to set mouse tips, show desired toolbars, etc.

void EAction::initUiOptions ( void  resume,
void  optionsToolBar 
)
inline

Overwrite to initialize combo boxes and other UI elements of the options tool bar.

void EAction::keyPressEvent ( void  event)
inline

Called when the user presses a key.

By default, the event is ignored.

void EAction::keyReleaseEvent ( void  event)
inline

Called when the user releases a key.

By default, the event is ignored.

void EAction::mouseDoubleClickEvent ( void  event)
inline
void EAction::mousePressEvent ( void  event)
inline

Does nothing.

Needs to be implemented here to avoid recursion when child classes call the base class implementation.

void EAction::mouseReleaseEvent ( void  event)
inline
void EAction::pickCoordinate ( void  event,
void  preview 
)
inline

High level event triggered when a coordinate was specified by the user of a coordinate specification should be previewed.

void EAction::pickEntity ( void  event,
void  preview 
)
inline

High level event triggered when an entity was picked by the user or to preview picking an entity.

void EAction::propertyChangeEvent ( void  event)
inline

Allows all actions to handle property change events.

This is neccessary to ensure that properties can be changed even if a tool is active (e.g. while drawing lines).

void EAction::resumeEvent ( )
inlinevirtual

Called whenver the action resumes its operation, for example after it was temporary suspended for another action.

Reimplemented from RActionAdapter.

Reimplemented in Information, and CloseFile.

void EAction::setArrowCursor ( )
inline

Sets the current cursor of the current document interface (all views attached to it) to the normal arrow cursor.

void EAction::setCommandPrompt ( void  prompt)
inline
void EAction::setCrosshairCursor ( )
inline

Sets the current cursor of the current document interface (all views attached to it) to crosshair cursor.

void EAction::setCursor ( void  cursor,
void  name 
)
inline
void EAction::setLeftMouseTip ( void  tip)
inline
void EAction::setRightMouseTip ( void  tip)
inline
void EAction::setState ( void  state)
inline

Set the state of this action.

Action implementations overwrite this function to initialize this action for the given state. This includes setting the appropriate click mode, displaying the appropriate CAD toolbar, setting mouse tips, mouse cursor, etc.

void EAction::setUiOptions ( void  uiFile,
void  split 
)
inline

Sets the UI options toolbar content for this tool.

By default, a tool shows the options toolbar defined in "DefaultOptions.ui".

Parameters
uiFileA path to a single UI file or an array of UI file paths.
splitIf true, the options are split up into multiple toolbars.
void EAction::showUiOptions ( void  resume,
void  restoreFromSettings 
)
inline

Shows the UI options of this action if this.uiFile is set.

UI options are typically shown in a horizontal toolbar at the top of the drawing area.

Usually this function does not need to be called directly by implementing actions.

Parameters
resumeAction was resumed from suspension.
restoreFromSettingsRestore settings from document / config file (default).
void EAction::simulateMouseMoveEvent ( )
inline
void EAction::slotReset ( )
inline

Called if the user clicks the reset button of an action.

A reset button may be displayed as part of the UI options of this action and must have the object name "Reset".

void EAction::suspendEvent ( )
inlinevirtual

Called whenver the action is suspended, for example if another action is started while this action is active.

Reimplemented from RActionAdapter.

Reimplemented in PrintPreview.

void EAction::updatePreview ( void  clear)
inlinevirtual

Updates the preview based on the operation returned by getOperation and the auxiliary construction returned be getAuxPreview.

Parameters
clearTrue to clear the preview first. This is necessary if the preview is updated not as a result of a mouse move event, e.g. when changing action parameters in the options toolbar.

Reimplemented from RActionAdapter.

Member Data Documentation

int EAction::additionalOptionsToolBars
int EAction::delegate
int EAction::guiAction
int EAction::includeBasePath
int EAction::optionsToolBarEnabled
int EAction::relativeZeroPos
int EAction::settingsGroup
int EAction::splitUiOptions
int EAction::state
int EAction::uiFile

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