QElectroTech  0.70
Public Types | Signals | Public Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
PartTerminal Class Reference

#include <partterminal.h>

Public Types

enum  { Type = UserType + 1106 }
 
- Public Types inherited from CustomElementGraphicPart
enum  LineStyle { NormalStyle, DashedStyle, DottedStyle, DashdottedStyle }
 
enum  LineWeight {
  NoneWeight, ThinWeight, NormalWeight, UltraWeight,
  BigWeight
}
 
enum  Filling {
  NoneFilling, BlackFilling, WhiteFilling, GreenFilling,
  RedFilling, BlueFilling, GrayFilling, BrunFilling,
  YellowFilling, CyanFilling, MagentaFilling, LightgrayFilling,
  OrangeFilling, PurpleFilling, HorFilling, VerFilling,
  BdiagFilling, FdiagFilling
}
 
enum  Color {
  BlackColor, WhiteColor, GreenColor, RedColor,
  BlueColor, GrayColor, BrunColor, YellowColor,
  CyanColor, MagentaColor, LightgrayColor, OrangeColor,
  PurpleColor, NoneColor
}
 

Signals

void orientationChanged ()
 

Public Member Functions

 PartTerminal (QETElementEditor *editor, QGraphicsItem *parent=nullptr)
 
 ~PartTerminal () override
 Destructeur. More...
 
int type () const override
 
QString name () const override
 
QString xmlName () const override
 
void fromXml (const QDomElement &) override
 
const QDomElement toXml (QDomDocument &) const override
 
void paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
 
QPainterPath shape () const override
 PartTerminal::shape. More...
 
QPainterPath shadowShape () const override
 
QRectF boundingRect () const override
 PartTerminal::boundingRect. More...
 
bool isUseless () const override
 
QRectF sceneGeometricRect () const override
 
void startUserTransformation (const QRectF &) override
 
void handleUserTransformation (const QRectF &, const QRectF &) override
 
Qet::Orientation orientation () const
 
void setOrientation (Qet::Orientation ori)
 
- Public Member Functions inherited from CustomElementGraphicPart
 CustomElementGraphicPart (QETElementEditor *editor, QGraphicsItem *parent=nullptr)
 CustomElementGraphicPart::CustomElementGraphicPart Default constructor. By default, item is selectable, send geometry change (Qt > 4.6), accept mouse left button and accept hover event. More...
 
 ~CustomElementGraphicPart () override
 CustomElementGraphicPart::~CustomElementGraphicPart Destructor. More...
 
LineStyle lineStyle () const
 
void setLineStyle (const LineStyle ls)
 CustomElementGraphicPart::setLineStyle Set line style to ls. More...
 
LineWeight lineWeight () const
 
void setLineWeight (const LineWeight lw)
 CustomElementGraphicPart::setLineWeight Set line weight to lw. More...
 
qreal penWeight () const
 CustomElementGraphicPart::penWeight. More...
 
Filling filling () const
 
void setFilling (const Filling f)
 CustomElementGraphicPart::setFilling Set filling to f. More...
 
Color color () const
 
void setColor (const Color c)
 CustomElementGraphicPart::setColor Set color to c. More...
 
bool antialiased () const
 
void setAntialiased (const bool b)
 CustomElementGraphicPart::setAntialiased Set antialias to b. More...
 
void setProperty (const char *name, const QVariant &value) override
 
QVariant property (const char *name) const override
 
- Public Member Functions inherited from CustomElementPart
 CustomElementPart (QETElementEditor *editor)
 
virtual ~CustomElementPart ()
 Destructor. More...
 
virtual QETElementEditorelementEditor () const
 
virtual void updateCurrentPartEditor () const
 
virtual ElementSceneelementScene () const
 
virtual QUndoStack & undoStack () const
 
virtual QGraphicsItem * toItem ()
 
virtual QET::ScalingMethod preferredScalingMethod () const
 

Properties

Qet::Orientation orientation
 
- Properties inherited from CustomElementGraphicPart
LineStyle line_style
 
LineWeight line_weight
 
Filling filling
 
Color color
 
bool antialias
 

Private Member Functions

 PartTerminal (const PartTerminal &)
 
void updateSecondPoint ()
 

Private Attributes

Qet::Orientation m_orientation
 
QPointF second_point
 
QPointF saved_position_
 

Additional Inherited Members

- Static Public Member Functions inherited from CustomElementGraphicPart
static void drawCross (const QPointF &center, QPainter *painter)
 CustomElementGraphicPart::drawCross Draw a cross at pos center. More...
 
- Protected Member Functions inherited from CustomElementGraphicPart
void stylesToXml (QDomElement &) const
 CustomElementGraphicPart::stylesToXml Write the curent style to xml element. The style are stored like this: name-of-style:value;name-of-style:value Each style separate by ; and name-style/value are separate by : More...
 
void stylesFromXml (const QDomElement &)
 CustomElementGraphicPart::stylesFromXml Read the style used by this, from a xml element. More...
 
void resetStyles ()
 CustomElementGraphicPart::resetStyles Reset the curent style to default, same style of default constructor. More...
 
void applyStylesToQPainter (QPainter &) const
 CustomElementGraphicPart::applyStylesToQPainter Apply the current style to the QPainter. More...
 
void drawShadowShape (QPainter *painter)
 CustomElementGraphicPart::drawShadowShape Draw a transparent blue shadow arround the shape of this item. The QPainterPathStroker used to draw shadows have a width of SHADOWS_HEIGHT Be carefull if penWeight of this item is to 0 the outline of strock is bigger of 0.5. More...
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 CustomElementGraphicPart::itemChange Reimplemented from QGraphicsObject. If the item position change call updateCurrentPartEditor() the change is always send to QGraphicsObject. More...
 
void hoverEnterEvent (QGraphicsSceneHoverEvent *event) override
 CustomElementGraphicPart::hoverEnterEvent Reimplemented from QGraphicsObject. Set m_hovered to true. More...
 
void hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override
 CustomElementGraphicPart::hoverLeaveEvent Reimplemented from QGraphicsObject. Set m_hovered to false. More...
 
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 
- Protected Member Functions inherited from CustomElementPart
QList< QPointF > mapPoints (const QRectF &, const QRectF &, const QList< QPointF > &)
 
- Protected Attributes inherited from CustomElementGraphicPart
bool m_hovered
 

Detailed Description

This class represents a terminal which may be used to compose the drawing of an electrical element within the element editor.

Definition at line 29 of file partterminal.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Definition at line 54 of file partterminal.h.

Constructor & Destructor Documentation

◆ PartTerminal() [1/2]

PartTerminal::PartTerminal ( QETElementEditor editor,
QGraphicsItem *  parent = nullptr 
)

Constructeur

Parameters
editorL'editeur d'element concerne
parentLe QGraphicsItem parent de cette borne
sceneLa scene sur laquelle figure cette borne

Definition at line 27 of file partterminal.cpp.

References updateSecondPoint().

◆ ~PartTerminal()

PartTerminal::~PartTerminal ( )
override

Destructeur.

Definition at line 36 of file partterminal.cpp.

◆ PartTerminal() [2/2]

PartTerminal::PartTerminal ( const PartTerminal )
private

Member Function Documentation

◆ boundingRect()

QRectF PartTerminal::boundingRect ( ) const
override

PartTerminal::boundingRect.

Returns
the bounding rect of this item

Definition at line 130 of file partterminal.cpp.

References QET::Icons::br, second_point, and SHADOWS_HEIGHT.

◆ fromXml()

void PartTerminal::fromXml ( const QDomElement &  xml_elmt)
overridevirtual

Importe les proprietes d'une borne depuis un element XML

Parameters
xml_elmtElement XML a lire

Implements CustomElementPart.

Definition at line 43 of file partterminal.cpp.

References QET::attributeIsAReal(), m_orientation, Qet::orientationFromString(), and updateSecondPoint().

◆ handleUserTransformation()

void PartTerminal::handleUserTransformation ( const QRectF &  initial_selection_rect,
const QRectF &  new_selection_rect 
)
overridevirtual

Handle the user-induced transformation from initial_selection_rect to new_selection_rect

Implements CustomElementPart.

Definition at line 199 of file partterminal.cpp.

References CustomElementPart::mapPoints(), and saved_position_.

◆ isUseless()

bool PartTerminal::isUseless ( ) const
overridevirtual
Returns
true si cette partie n'est pas pertinente et ne merite pas d'etre conservee / enregistree. Une borne est toujours pertinente ; cette fonction renvoie donc toujours false

Implements CustomElementPart.

Definition at line 173 of file partterminal.cpp.

◆ name()

QString PartTerminal::name ( ) const
inlineoverridevirtual
Returns
the name of the primitive

Implements CustomElementPart.

Definition at line 60 of file partterminal.h.

References QET::Icons::tr.

◆ orientation()

Qet::Orientation PartTerminal::orientation ( ) const
inline

Definition at line 74 of file partterminal.h.

References m_orientation.

◆ orientationChanged

void PartTerminal::orientationChanged ( )
signal

◆ paint()

void PartTerminal::paint ( QPainter *  p,
const QStyleOptionGraphicsItem *  options,
QWidget *  widget 
)
override

Dessine la borne

Parameters
pQPainter a utiliser pour rendre le dessin
optionsOptions pour affiner le rendu
widgetWidget sur lequel le rendu est effectue

Definition at line 82 of file partterminal.cpp.

References CustomElementGraphicPart::drawShadowShape(), CustomElementGraphicPart::m_hovered, Terminal::neutralColor, and second_point.

◆ sceneGeometricRect()

QRectF PartTerminal::sceneGeometricRect ( ) const
overridevirtual
Returns
the minimum, margin-less rectangle this part can fit into, in scene coordinates. It is different from boundingRect() because it is not supposed to imply any margin, and it is different from shape because it is a regular rectangle, not a complex shape.

Implements CustomElementPart.

Definition at line 183 of file partterminal.cpp.

◆ setOrientation()

void PartTerminal::setOrientation ( Qet::Orientation  ori)

Definit l'orientation de la borne

Parameters
orila nouvelle orientation de la borne

Definition at line 144 of file partterminal.cpp.

References m_orientation, orientationChanged(), and updateSecondPoint().

◆ shadowShape()

QPainterPath PartTerminal::shadowShape ( ) const
inlineoverridevirtual

Implements CustomElementGraphicPart.

Definition at line 67 of file partterminal.h.

References shape().

◆ shape()

QPainterPath PartTerminal::shape ( ) const
override

PartTerminal::shape.

Returns
the shape of this item

Definition at line 115 of file partterminal.cpp.

References second_point.

Referenced by shadowShape().

◆ startUserTransformation()

void PartTerminal::startUserTransformation ( const QRectF &  initial_selection_rect)
overridevirtual

Start the user-induced transformation, provided this primitive is contained within the initial_selection_rect bounding rectangle.

Implements CustomElementPart.

Definition at line 191 of file partterminal.cpp.

References saved_position_.

◆ toXml()

const QDomElement PartTerminal::toXml ( QDomDocument &  xml_document) const
overridevirtual

Exporte la borne en XML

Parameters
xml_documentDocument XML a utiliser pour creer l'element XML
Returns
un element XML decrivant la borne

Implements CustomElementPart.

Definition at line 61 of file partterminal.cpp.

References m_orientation, and Qet::orientationToString().

◆ type()

int PartTerminal::type ( ) const
inlineoverride

Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a PartTerminal.

Returns
the QGraphicsItem type

Definition at line 59 of file partterminal.h.

References Type.

◆ updateSecondPoint()

void PartTerminal::updateSecondPoint ( )
private

Met a jour la position du second point en fonction de la position et de l'orientation de la borne.

Definition at line 157 of file partterminal.cpp.

References Qet::East, m_orientation, Qet::North, second_point, Qet::South, and Qet::West.

Referenced by fromXml(), PartTerminal(), and setOrientation().

◆ xmlName()

QString PartTerminal::xmlName ( ) const
inlineoverridevirtual
Returns
the name that will be used as XML tag when exporting the primitive

Implements CustomElementPart.

Definition at line 61 of file partterminal.h.

Member Data Documentation

◆ m_orientation

Qet::Orientation PartTerminal::m_orientation
private

Definition at line 48 of file partterminal.h.

Referenced by fromXml(), orientation(), setOrientation(), toXml(), and updateSecondPoint().

◆ saved_position_

QPointF PartTerminal::saved_position_
private

Definition at line 81 of file partterminal.h.

Referenced by handleUserTransformation(), and startUserTransformation().

◆ second_point

QPointF PartTerminal::second_point
private

Definition at line 49 of file partterminal.h.

Referenced by boundingRect(), paint(), shape(), and updateSecondPoint().

Property Documentation

◆ orientation

Qet::Orientation PartTerminal::orientation
readwrite

Definition at line 33 of file partterminal.h.

Referenced by ESEventAddTerminal::keyPressEvent().


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