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

The CustomElementPart class 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. More...

#include <customelementpart.h>

Inheritance diagram for CustomElementPart:
Inheritance graph
Collaboration diagram for CustomElementPart:
Collaboration graph

Public Member Functions

 CustomElementPart (QETElementEditor *editor)
 CustomElementPart Constructor. More...
 
virtual ~CustomElementPart ()
 ~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

The CustomElementPart class 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.

Constructor & Destructor Documentation

◆ CustomElementPart() [1/2]

CustomElementPart::CustomElementPart ( QETElementEditor editor)
inline

CustomElementPart Constructor.

Parameters
editorElement editor this primitive is attached to

◆ ~CustomElementPart()

virtual CustomElementPart::~CustomElementPart ( )
inlinevirtual

~CustomElementPart Destructor

◆ 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

◆ elementScene()

ElementScene * CustomElementPart::elementScene ( ) const
virtual
Returns
a pointer to the parent editing scene
l'ElementScene contenant les parties editees par cet editeur
Here is the caller graph for this function:

◆ 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, PartText, PartEllipse, PartTerminal, and PartArc.

Here is the caller graph for this function:

◆ handleUserTransformation()

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

Make this part fit into the provided rectangle.

Implemented in PartDynamicTextField, PartLine, PartRectangle, PartPolygon, PartText, PartTerminal, 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, AbstractPartEllipse, PartPolygon, PartText, and PartTerminal.

◆ 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
Here is the caller graph for this function:

◆ name()

virtual QString CustomElementPart::name ( ) const
pure virtual
Returns
the name of the primitive

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

Here is the caller graph for this function:

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

◆ 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 PartDynamicTextField, PartLine, PartRectangle, PartPolygon, PartText, PartTerminal, and AbstractPartEllipse.

◆ toItem()

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

◆ toXml()

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

Export the primitive as an XML element

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

◆ undoStack()

QUndoStack & CustomElementPart::undoStack ( ) const
virtual
Returns
the element editor undo stack
la QUndoStack a utiliser pour les annulations
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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()
Here is the caller graph for this function:

◆ 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, PartText, PartTerminal, PartEllipse, and PartArc.

Member Data Documentation

◆ element_editor

QETElementEditor* CustomElementPart::element_editor
private

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