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

#include <elementsmover.h>

Public Member Functions

 ElementsMover ()
 ElementsMover::ElementsMover Constructor. More...
 
virtual ~ElementsMover ()
 ElementsMover::~ElementsMover Destructor. More...
 
bool isReady () const
 ElementsMover::isReady. More...
 
int beginMovement (Diagram *, QGraphicsItem *=nullptr)
 ElementsMover::beginMovement Start a new movement. More...
 
void continueMovement (const QPointF &)
 ElementsMover::continueMovement Add a move to the current movement. More...
 
void endMovement ()
 ElementsMover::endMovement Ended the current movement by creating an undo added to the undostack of the diagram. If there is only one element moved, we try to auto-connect new conductor from this element and other possible element. More...
 

Private Member Functions

 ElementsMover (const ElementsMover &)
 

Private Attributes

bool movement_running_
 
QPointF current_movement_
 
Diagramdiagram_
 
QGraphicsItem * m_movement_driver
 
DiagramContent m_moved_content
 

Detailed Description

This class manages the interactive movement of different items (elements, conductors, text items etc...) on a particular diagram.

A movement work in 3 steps: 1: beginMovement -> init a new movement 2: continueMovement -> continue the curent movement 3: endMovement -> finish the curent movement

A movement in progress must finish befor start a new movement. We can know if element mover is ready for a new movement by calling isReady().

Definition at line 38 of file elementsmover.h.

Constructor & Destructor Documentation

◆ ElementsMover() [1/2]

ElementsMover::ElementsMover ( )

ElementsMover::ElementsMover Constructor.

Definition at line 33 of file elementsmover.cpp.

◆ ~ElementsMover()

ElementsMover::~ElementsMover ( )
virtual

ElementsMover::~ElementsMover Destructor.

Definition at line 46 of file elementsmover.cpp.

◆ ElementsMover() [2/2]

ElementsMover::ElementsMover ( const ElementsMover )
private

Member Function Documentation

◆ beginMovement()

int ElementsMover::beginMovement ( Diagram diagram,
QGraphicsItem *  driver_item = nullptr 
)

ElementsMover::beginMovement Start a new movement.

Parameters
diagramdiagram where the movement is applied
driver_itemitem moved by mouse and don't be moved by Element mover
Returns
the numbers of items to be moved or -1 if movement can't be init.

Definition at line 65 of file elementsmover.cpp.

References DiagramContent::count(), current_movement_, diagram_, DiagramContent::m_element_texts, DiagramContent::m_elements, m_moved_content, m_movement_driver, DiagramContent::m_texts_groups, movement_running_, and DiagramContent::removeNonMovableItems().

Referenced by Diagram::keyPressEvent(), QetGraphicsItem::mouseMoveEvent(), and DiagramTextItem::mouseMoveEvent().

◆ continueMovement()

void ElementsMover::continueMovement ( const QPointF &  movement)

◆ endMovement()

void ElementsMover::endMovement ( )

ElementsMover::endMovement Ended the current movement by creating an undo added to the undostack of the diagram. If there is only one element moved, we try to auto-connect new conductor from this element and other possible element.

Definition at line 151 of file elementsmover.cpp.

References Element::AlignedFreeTerminals(), DiagramContent::clear(), QET::Icons::Conductor, current_movement_, diagram_, DiagramContent::items(), DiagramContent::m_elements, m_moved_content, movement_running_, ConductorAutoNumerotation::numerate(), Conductor::properties, and QET::Icons::tr.

Referenced by Diagram::keyReleaseEvent(), QetGraphicsItem::mouseReleaseEvent(), and DiagramTextItem::mouseReleaseEvent().

◆ isReady()

bool ElementsMover::isReady ( ) const

ElementsMover::isReady.

Returns
True if this element mover is ready to be used. A element mover is ready when the previous managed movement is finish.

Definition at line 54 of file elementsmover.cpp.

References movement_running_.

Member Data Documentation

◆ current_movement_

QPointF ElementsMover::current_movement_
private

Definition at line 56 of file elementsmover.h.

Referenced by beginMovement(), continueMovement(), and endMovement().

◆ diagram_

Diagram* ElementsMover::diagram_
private

Definition at line 57 of file elementsmover.h.

Referenced by beginMovement(), and endMovement().

◆ m_moved_content

DiagramContent ElementsMover::m_moved_content
private

Definition at line 59 of file elementsmover.h.

Referenced by beginMovement(), continueMovement(), and endMovement().

◆ m_movement_driver

QGraphicsItem* ElementsMover::m_movement_driver
private

Definition at line 58 of file elementsmover.h.

Referenced by beginMovement(), and continueMovement().

◆ movement_running_

bool ElementsMover::movement_running_
private

Definition at line 55 of file elementsmover.h.

Referenced by beginMovement(), continueMovement(), endMovement(), and isReady().


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