Page 1 of 1

RAction vs. ROperation

Posted: Mon Nov 18, 2013 10:41 am
by andrew
From a QCAD user:

In browsing the QCAD source, I've come across a little bit of confusion: I see RAction and ROperation, but I'm a little bit confused at the difference between them, and how they're related. Could you clarify?

Re: RAction vs. ROperation

Posted: Mon Nov 18, 2013 10:47 am
by andrew
RAction classes handle user interaction with a document. An action reacts to mouse clicks, coordinates that are being entered, etc.

Example for RAction implementations: File - Open, Zoom in, Draw line from two points and any other QCAD tool.
Actions are the 'glue' between the user inputs and the QCAD application.


ROperation classes encapsulate a modification that can be applied to a document.

Such an operation might add objects (entities, layers, blocks, ...), delete objects or modify objects.
Operations are a low level concept and would also exist in an application without user interface.

Re: RAction vs. ROperation

Posted: Mon Nov 25, 2013 7:07 pm
by galed
What about RGuiActions? They seem kind of redundant with RActions

How are ROperations rolled into the undo framework provided by the transaction stack?

Re: RAction vs. ROperation

Posted: Tue Nov 26, 2013 10:27 am
by andrew
galed wrote:What about RGuiActions? They seem kind of redundant with RActions
A GUI action (RGuiAction) represents an action in the user interface. A GUI action is typically visualized by a menu and optionally a tool button. RGuiActions can also be triggered through command input. RGuiAction is derived from QAction and serves the same purpose.
How are ROperations rolled into the undo framework provided by the transaction stack?
ROperations typically trigger transactions (RTransaction) on a lower level. Transactions are undoable.