QElectroTech  0.70
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ScalePartsCommand Class Reference

#include <editorcommands.h>

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 &)
 
QPair< QRectF, QRectF > transformation ()
 
- Public Member Functions inherited from ElementEditionCommand
 ElementEditionCommand (ElementScene *=nullptr, ElementView *=nullptr, QUndoCommand *=nullptr)
 
 ElementEditionCommand (const QString &, ElementScene *=nullptr, ElementView *=nullptr, QUndoCommand *=nullptr)
 
 ~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.

Definition at line 257 of file editorcommands.h.

Constructor & Destructor Documentation

◆ ScalePartsCommand() [1/2]

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

Constructor

Parameters
sceneModified ElementScene
parentParent QUndoCommand

Definition at line 494 of file editorcommands.cpp.

◆ ~ScalePartsCommand()

ScalePartsCommand::~ScalePartsCommand ( )
override

Destructor

Definition at line 502 of file editorcommands.cpp.

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

Definition at line 581 of file editorcommands.cpp.

References scaled_primitives_, and QET::Icons::tr.

Referenced by setScaledPrimitives().

◆ elementScene()

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

Definition at line 526 of file editorcommands.cpp.

References ElementEditionCommand::m_scene.

◆ redo()

void ScalePartsCommand::redo ( )
override

Redo the scaling operation

Definition at line 515 of file editorcommands.cpp.

References first_redo, new_rect_, original_rect_, and scale().

◆ scale()

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

Apply the scaling operation from before to after.

Definition at line 567 of file editorcommands.cpp.

References scaled_primitives_.

Referenced by redo(), and undo().

◆ scaledPrimitives()

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

Definition at line 541 of file editorcommands.cpp.

References scaled_primitives_.

◆ setScaledPrimitives()

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

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

Definition at line 533 of file editorcommands.cpp.

References adjustText(), and scaled_primitives_.

◆ setTransformation()

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

Define the transformation applied by this command

Parameters
original_rectBounding rectangle for all scaled primitives before the operation
original_rectBounding rectangle for all scaled primitives after the operation

Definition at line 550 of file editorcommands.cpp.

References new_rect_, and original_rect_.

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

Definition at line 560 of file editorcommands.cpp.

References new_rect_, and original_rect_.

◆ undo()

void ScalePartsCommand::undo ( )
override

Undo the scaling operation

Definition at line 508 of file editorcommands.cpp.

References new_rect_, original_rect_, and scale().

Member Data Documentation

◆ first_redo

bool ScalePartsCommand::first_redo
private

Prevent the first call to redo()

Definition at line 288 of file editorcommands.h.

Referenced by redo().

◆ new_rect_

QRectF ScalePartsCommand::new_rect_
private

new rect items should fit in

Definition at line 286 of file editorcommands.h.

Referenced by redo(), setTransformation(), transformation(), and undo().

◆ original_rect_

QRectF ScalePartsCommand::original_rect_
private

original rect items fit in

Definition at line 284 of file editorcommands.h.

Referenced by redo(), setTransformation(), transformation(), and undo().

◆ scaled_primitives_

QList<CustomElementPart *> ScalePartsCommand::scaled_primitives_
private

List of moved primitives.

Definition at line 282 of file editorcommands.h.

Referenced by adjustText(), scale(), scaledPrimitives(), and setScaledPrimitives().


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