QElectroTech  0.70
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CustomElementPart Class Referenceabstract

#include <customelementpart.h>

Public Member Functions

 CustomElementPart (QETElementEditor *editor)
 
virtual ~CustomElementPart ()
 Destructor. More...
 
virtual void fromXml (const QDomElement &)=0
 
virtual const QDomElement toXml (QDomDocument &) const =0
 
virtual void setProperty (const char *name, const QVariant &value)=0
 
virtual QVariant property (const char *name) const =0
 
virtual bool isUseless () const =0
 
virtual QRectF sceneGeometricRect () const =0
 
virtual void startUserTransformation (const QRectF &)=0
 
virtual void handleUserTransformation (const QRectF &, const QRectF &)=0
 
virtual QETElementEditorelementEditor () const
 
virtual void updateCurrentPartEditor () const
 
virtual ElementSceneelementScene () const
 
virtual QUndoStack & undoStack () const
 
virtual QString name () const =0
 
virtual QString xmlName () const =0
 
virtual QGraphicsItem * toItem ()
 
virtual QET::ScalingMethod preferredScalingMethod () const
 

Protected Member Functions

QList< QPointF > mapPoints (const QRectF &, const QRectF &, const QList< QPointF > &)
 

Private Member Functions

 CustomElementPart (const CustomElementPart &)
 

Private Attributes

QETElementEditorelement_editor
 

Detailed Description

This abstract class represents a primitive of the visual representation of an electrical element. The Element, FixedElement and CustomElement classes do not embed its attributes and methods in order to remain lightweight; indeed, there is no point for those classes to store their visual representation with anything more complex than a QImage.

Definition at line 38 of file customelementpart.h.

Constructor & Destructor Documentation

◆ CustomElementPart() [1/2]

CustomElementPart::CustomElementPart ( QETElementEditor editor)
inline

Constructor

Parameters
editorElement editor this primitive is attached to

Definition at line 45 of file customelementpart.h.

◆ ~CustomElementPart()

virtual CustomElementPart::~CustomElementPart ( )
inlinevirtual

Destructor.

Definition at line 47 of file customelementpart.h.

◆ CustomElementPart() [2/2]

CustomElementPart::CustomElementPart ( const CustomElementPart )
private

Member Function Documentation

◆ elementEditor()

QETElementEditor * CustomElementPart::elementEditor ( ) const
virtual
Returns
a pointer to the parent element editor
le QETElementEditor auquel cet editeur appartient

Definition at line 22 of file customelementpart.cpp.

References element_editor.

◆ elementScene()

ElementScene * CustomElementPart::elementScene ( ) const
virtual

◆ fromXml()

virtual void CustomElementPart::fromXml ( const QDomElement &  )
pure virtual

Load the primitive from an XML element that describes it

Implemented in PartDynamicTextField, PartLine, PartPolygon, PartRectangle, PartTerminal, PartText, PartEllipse, and PartArc.

Referenced by ElementScene::loadContent().

◆ handleUserTransformation()

virtual void CustomElementPart::handleUserTransformation ( const QRectF &  ,
const QRectF &   
)
pure virtual

Make this part fit into the provided rectangle.

Implemented in PartLine, PartRectangle, PartDynamicTextField, PartPolygon, PartTerminal, PartText, and AbstractPartEllipse.

◆ isUseless()

virtual bool CustomElementPart::isUseless ( ) const
pure virtual
Returns
whether the primitive appears to be useless (e.g. 0-length line) Typically, useless primitives are discarded when saving the element.

Implemented in PartLine, PartRectangle, PartDynamicTextField, PartPolygon, PartTerminal, AbstractPartEllipse, and PartText.

◆ mapPoints()

QList< QPointF > CustomElementPart::mapPoints ( const QRectF &  initial_selection_rect,
const QRectF &  new_selection_rect,
const QList< QPointF > &  points 
)
protected

Helper method to map points in CustomElementPart::handleUserTransformation()

Parameters
initial_selection_rectSelection rectangle when the movement started, in scene coordinates
new_selection_rectNew selection rectangle, in scene coordinates
pointsList of points when the movement started, in scene coordinates.
Returns
The list of points mapped from initial_selection_rect to new_selection_rect

Definition at line 69 of file customelementpart.cpp.

Referenced by AbstractPartEllipse::handleUserTransformation(), PartText::handleUserTransformation(), PartTerminal::handleUserTransformation(), PartPolygon::handleUserTransformation(), PartDynamicTextField::handleUserTransformation(), PartRectangle::handleUserTransformation(), and PartLine::handleUserTransformation().

◆ name()

virtual QString CustomElementPart::name ( ) const
pure virtual

◆ preferredScalingMethod()

QET::ScalingMethod CustomElementPart::preferredScalingMethod ( ) const
virtual

This method is called by the decorator when it needs to determine the best way to interactively scale a primitive. It is typically called when only a single primitive is being scaled. The default implementation systematically returns QET::SnapScalingPointToGrid

Reimplemented in PartPolygon.

Definition at line 58 of file customelementpart.cpp.

References QET::SnapScalingPointToGrid.

◆ property()

virtual QVariant CustomElementPart::property ( const char *  name) const
pure virtual

Get the current value of a specific primitive property

Implemented in CustomElementGraphicPart, PartText, and PartDynamicTextField.

◆ sceneGeometricRect()

virtual QRectF CustomElementPart::sceneGeometricRect ( ) const
pure virtual

◆ setProperty()

virtual void CustomElementPart::setProperty ( const char *  name,
const QVariant &  value 
)
pure virtual

Set a specific property of the primitive

Implemented in CustomElementGraphicPart, PartText, and PartDynamicTextField.

◆ startUserTransformation()

virtual void CustomElementPart::startUserTransformation ( const QRectF &  )
pure virtual

Inform this part a user-induced transformation is about to begin. This method can be used to save data required by handleUserTransformation().

Implemented in PartLine, PartRectangle, PartDynamicTextField, PartPolygon, PartTerminal, PartText, and AbstractPartEllipse.

◆ toItem()

QGraphicsItem * CustomElementPart::toItem ( )
virtual
Returns
this primitive as a QGraphicsItem

Definition at line 47 of file customelementpart.cpp.

Referenced by DynamicTextFieldEditor::setPart().

◆ toXml()

virtual const QDomElement CustomElementPart::toXml ( QDomDocument &  ) const
pure virtual

Export the primitive as an XML element

Implemented in PartDynamicTextField, PartLine, PartPolygon, PartRectangle, PartTerminal, PartText, PartEllipse, and PartArc.

◆ undoStack()

QUndoStack & CustomElementPart::undoStack ( ) const
virtual
Returns
the element editor undo stack
la QUndoStack a utiliser pour les annulations

Definition at line 42 of file customelementpart.cpp.

References elementScene().

Referenced by PartText::endEdition().

◆ updateCurrentPartEditor()

void CustomElementPart::updateCurrentPartEditor ( ) const
virtual

Call the updateCurrentPartEditor() slot of the editor

See also
QETElementEditor::updateCurrentPartEditor()

Appelle le slot updateCurrentPartEditor de l'editeur

See also
QETElementEditor::updateCurrentPartEditor()

Definition at line 30 of file customelementpart.cpp.

References element_editor.

Referenced by PartText::itemChange(), CustomElementGraphicPart::itemChange(), and PartDynamicTextField::itemChange().

◆ xmlName()

virtual QString CustomElementPart::xmlName ( ) const
pure virtual
Returns
the name that will be used as XML tag when exporting the primitive

Implemented in PartLine, PartDynamicTextField, PartPolygon, PartRectangle, PartTerminal, PartText, PartEllipse, and PartArc.

Member Data Documentation

◆ element_editor

QETElementEditor* CustomElementPart::element_editor
private

Definition at line 54 of file customelementpart.h.

Referenced by elementEditor(), elementScene(), and updateCurrentPartEditor().


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