QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
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.
virtual ~CustomElementPart ()
 ~CustomElementPart Destructor
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
Here is the caller graph for this function:

◆ ~CustomElementPart()

virtual CustomElementPart::~CustomElementPart ( )
inlinevirtual

~CustomElementPart Destructor

◆ CustomElementPart() [2/2]

CustomElementPart::CustomElementPart ( const CustomElementPart & )
private
Here is the call graph for this function:

Member Function Documentation

◆ elementEditor()

QETElementEditor * CustomElementPart::elementEditor ( ) const
virtual
Returns
a pointer to the parent element editor
le QETElementEditor auquel cet editeur appartient
Here is the caller graph for this function:

◆ 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 call graph for this function:
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 PartArc, PartDynamicTextField, PartEllipse, PartLine, PartPlcTable, PartPolygon, PartRectangle, PartTerminal, and PartText.

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

◆ 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 AbstractPartEllipse, PartDynamicTextField, PartLine, PartPlcTable, PartPolygon, PartRectangle, PartTerminal, 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
Here is the caller graph for this function:

◆ name()

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

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

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, PartDynamicTextField, and PartText.

Here is the call graph for this function:

◆ 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, PartDynamicTextField, and PartText.

Here is the call graph for this function:

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

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

◆ 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 call graph for this function:
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 PartArc, PartDynamicTextField, PartEllipse, PartLine, PartPlcTable, PartPolygon, PartRectangle, PartTerminal, and PartText.

Member Data Documentation

◆ element_editor

QETElementEditor* CustomElementPart::element_editor
private

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