QElectroTech  0.8-dev
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ScalePartsCommand Class Reference

#include <editorcommands.h>

Inheritance diagram for ScalePartsCommand:
Inheritance graph
Collaboration diagram for ScalePartsCommand:
Collaboration graph

Public Member Functions

 ScalePartsCommand (ElementScene *=nullptr, QUndoCommand *=nullptr)
 
 ~ScalePartsCommand () override
 
void undo () override
 
void redo () override
 
ElementSceneelementScene () const
 
void setScaledPrimitives (const QList< CustomElementPart * > &)
 
QList< CustomElementPart * > scaledPrimitives () const
 
void setTransformation (const QRectF &, const QRectF &)
 ScalePartsCommand::setTransformation Define the transformation applied by this command. More...
 
QPair< QRectF, QRectF > transformation ()
 
- Public Member Functions inherited from ElementEditionCommand
 ElementEditionCommand (ElementScene *=nullptr, ElementView *=nullptr, QUndoCommand *=nullptr)
 ElementEditionCommand::ElementEditionCommand Constructs an ElementEditionCommand, thus embedding the provided scene and view. More...
 
 ElementEditionCommand (const QString &, ElementScene *=nullptr, ElementView *=nullptr, QUndoCommand *=nullptr)
 ElementEditionCommand::ElementEditionCommand Constructs an ElementEditionCommand, thus embedding the provided scene and view. More...
 
 ~ElementEditionCommand () override
 
ElementSceneelementScene () const
 
void setElementScene (ElementScene *)
 
ElementViewelementView () const
 
void setElementView (ElementView *)
 

Protected Member Functions

void scale (const QRectF &before, const QRectF &after)
 
void adjustText ()
 

Private Member Functions

 ScalePartsCommand (const ScalePartsCommand &)
 

Private Attributes

QList< CustomElementPart * > scaled_primitives_
 List of moved primitives. More...
 
QRectF original_rect_
 original rect items fit in More...
 
QRectF new_rect_
 new rect items should fit in More...
 
bool first_redo
 Prevent the first call to redo() More...
 

Additional Inherited Members

- Protected Attributes inherited from ElementEditionCommand
ElementScenem_scene
 Element editor/view/scene the command should take place on. More...
 
ElementViewm_view
 

Detailed Description

This command scales primitives when editing an electrical element.

Constructor & Destructor Documentation

◆ ScalePartsCommand() [1/2]

ScalePartsCommand::ScalePartsCommand ( ElementScene scene = nullptr,
QUndoCommand *  parent = nullptr 
)

Constructor

Parameters
sceneModified ElementScene
parentParent QUndoCommand

◆ ~ScalePartsCommand()

ScalePartsCommand::~ScalePartsCommand ( )
override

Destructor

◆ ScalePartsCommand() [2/2]

ScalePartsCommand::ScalePartsCommand ( const ScalePartsCommand )
private

Member Function Documentation

◆ adjustText()

void ScalePartsCommand::adjustText ( )
protected

Generate the text describing what this command does exactly.

Here is the caller graph for this function:

◆ elementScene()

ElementScene * ScalePartsCommand::elementScene ( ) const
Returns
the element editor/scene the command should take place on

◆ redo()

void ScalePartsCommand::redo ( )
override

Redo the scaling operation

Here is the call graph for this function:

◆ scale()

void ScalePartsCommand::scale ( const QRectF &  before,
const QRectF &  after 
)
protected

Apply the scaling operation from before to after.

Here is the caller graph for this function:

◆ scaledPrimitives()

QList< CustomElementPart * > ScalePartsCommand::scaledPrimitives ( ) const
Returns
the list of primitives to be scaled by this command

◆ setScaledPrimitives()

void ScalePartsCommand::setScaledPrimitives ( const QList< CustomElementPart * > &  primitives)

Set primitives as the list of primitives to be scaled by this command

Here is the call graph for this function:

◆ setTransformation()

void ScalePartsCommand::setTransformation ( const QRectF &  original_rect,
const QRectF &  new_rect 
)

ScalePartsCommand::setTransformation Define the transformation applied by this command.

Parameters
original_rect: Bounding rectangle for all scaled primitives before the operation
new_rect: Bounding rectangle for all scaled primitives after the operation

◆ transformation()

QPair< QRectF, QRectF > ScalePartsCommand::transformation ( )
Returns
the transformation applied by this command. The returned rectangles are the bounding rectangles for all scaled primitives respectively before and after the operation.

◆ undo()

void ScalePartsCommand::undo ( )
override

Undo the scaling operation

Here is the call graph for this function:

Member Data Documentation

◆ first_redo

bool ScalePartsCommand::first_redo
private

Prevent the first call to redo()

◆ new_rect_

QRectF ScalePartsCommand::new_rect_
private

new rect items should fit in

◆ original_rect_

QRectF ScalePartsCommand::original_rect_
private

original rect items fit in

◆ scaled_primitives_

QList<CustomElementPart *> ScalePartsCommand::scaled_primitives_
private

List of moved primitives.


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