QElectroTech  0.8-dev
Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
PartLine Class Reference

#include <partline.h>

Inheritance diagram for PartLine:
Inheritance graph
Collaboration diagram for PartLine:
Collaboration graph

Public Types

enum  { Type = UserType + 1104 }
 
- 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, HTMLPinkPinkFilling, HTMLPinkLightPinkFilling,
  HTMLPinkHotPinkFilling, HTMLPinkDeepPinkFilling, HTMLPinkPaleVioletRedFilling, HTMLPinkMediumVioletRedFilling,
  HTMLRedLightSalmonFilling, HTMLRedSalmonFilling, HTMLRedDarkSalmonFilling, HTMLRedLightCoralFilling,
  HTMLRedIndianRedFilling, HTMLRedCrimsonFilling, HTMLRedFirebrickFilling, HTMLRedDarkRedFilling,
  HTMLRedRedFilling, HTMLOrangeOrangeRedFilling, HTMLOrangeTomatoFilling, HTMLOrangeCoralFilling,
  HTMLOrangeDarkOrangeFilling, HTMLOrangeOrangeFilling, HTMLYellowYellowFilling, HTMLYellowLightYellowFilling,
  HTMLYellowLemonChiffonFilling, HTMLYellowLightGoldenrodYellowFilling, HTMLYellowPapayaWhipFilling, HTMLYellowMoccasinFilling,
  HTMLYellowPeachPuffFilling, HTMLYellowPaleGoldenrodFilling, HTMLYellowKhakiFilling, HTMLYellowDarkKhakiFilling,
  HTMLYellowGoldFilling, HTMLBrownCornsilkFilling, HTMLBrownBlanchedAlmondFilling, HTMLBrownBisqueFilling,
  HTMLBrownNavajoWhiteFilling, HTMLBrownWheatFilling, HTMLBrownBurlywoodFilling, HTMLBrownTanFilling,
  HTMLBrownRosyBrownFilling, HTMLBrownSandyBrownFilling, HTMLBrownGoldenrodFilling, HTMLBrownDarkGoldenrodFilling,
  HTMLBrownPeruFilling, HTMLBrownChocolateFilling, HTMLBrownSaddleBrownFilling, HTMLBrownSiennaFilling,
  HTMLBrownBrownFilling, HTMLBrownMaroonFilling, HTMLGreenDarkOliveGreenFilling, HTMLGreenOliveFilling,
  HTMLGreenOliveDrabFilling, HTMLGreenYellowGreenFilling, HTMLGreenLimeGreenFilling, HTMLGreenLimeFilling,
  HTMLGreenLawnGreenFilling, HTMLGreenChartreuseFilling, HTMLGreenGreenYellowFilling, HTMLGreenSpringGreenFilling,
  HTMLGreenMediumSpringGreenFilling, HTMLGreenLightGreenFilling, HTMLGreenPaleGreenFilling, HTMLGreenDarkSeaGreenFilling,
  HTMLGreenMediumAquamarineFilling, HTMLGreenMediumSeaGreenFilling, HTMLGreenSeaGreenFilling, HTMLGreenForestGreenFilling,
  HTMLGreenGreenFilling, HTMLGreenDarkGreenFilling, HTMLCyanAquaFilling, HTMLCyanCyanFilling,
  HTMLCyanLightCyanFilling, HTMLCyanPaleTurquoiseFilling, HTMLCyanAquamarineFilling, HTMLCyanTurquoiseFilling,
  HTMLCyanMediumTurquoiseFilling, HTMLCyanDarkTurquoiseFilling, HTMLCyanLightSeaGreenFilling, HTMLCyanCadetBlueFilling,
  HTMLCyanDarkCyanFilling, HTMLCyanTealFilling, HTMLBlueLightSteelBlueFilling, HTMLBluePowderBlueFilling,
  HTMLBlueLightBlueFilling, HTMLBlueSkyBlueFilling, HTMLBlueLightSkyBlueFilling, HTMLBlueDeepSkyBlueFilling,
  HTMLBlueDodgerBlueFilling, HTMLBlueCornflowerBlueFilling, HTMLBlueSteelBlueFilling, HTMLBlueRoyalBlueFilling,
  HTMLBlueBlueFilling, HTMLBlueMediumBlueFilling, HTMLBlueDarkBlueFilling, HTMLBlueNavyFilling,
  HTMLBlueMidnightBlueFilling, HTMLPurpleLavenderFilling, HTMLPurpleThistleFilling, HTMLPurplePlumFilling,
  HTMLPurpleVioletFilling, HTMLPurpleOrchidFilling, HTMLPurpleFuchsiaFilling, HTMLPurpleMagentaFilling,
  HTMLPurpleMediumOrchidFilling, HTMLPurpleMediumPurpleFilling, HTMLPurpleBlueVioletFilling, HTMLPurpleDarkVioletFilling,
  HTMLPurpleDarkOrchidFilling, HTMLPurpleDarkMagentaFilling, HTMLPurplePurpleFilling, HTMLPurpleIndigoFilling,
  HTMLPurpleDarkSlateBlueFilling, HTMLPurpleSlateBlueFilling, HTMLPurpleMediumSlateBlueFilling, HTMLWhiteWhiteFilling,
  HTMLWhiteSnowFilling, HTMLWhiteHoneydewFilling, HTMLWhiteMintCreamFilling, HTMLWhiteAzureFilling,
  HTMLWhiteAliceBlueFilling, HTMLWhiteGhostWhiteFilling, HTMLWhiteWhiteSmokeFilling, HTMLWhiteSeashellFilling,
  HTMLWhiteBeigeFilling, HTMLWhiteOldLaceFilling, HTMLWhiteFloralWhiteFilling, HTMLWhiteIvoryFilling,
  HTMLWhiteAntiqueWhiteFilling, HTMLWhiteLinenFilling, HTMLWhiteLavenderBlushFilling, HTMLWhiteMistyRoseFilling,
  HTMLGrayGainsboroFilling, HTMLGrayLightGrayFilling, HTMLGraySilverFilling, HTMLGrayDarkGrayFilling,
  HTMLGrayGrayFilling, HTMLGrayDimGrayFilling, HTMLGrayLightSlateGrayFilling, HTMLGraySlateGrayFilling,
  HTMLGrayDarkSlateGrayFilling, HTMLGrayBlackFilling, HorFilling, VerFilling,
  BdiagFilling, FdiagFilling
}
 
enum  Color {
  BlackColor, WhiteColor, GreenColor, RedColor,
  BlueColor, GrayColor, BrunColor, YellowColor,
  CyanColor, MagentaColor, LightgrayColor, OrangeColor,
  PurpleColor, HTMLPinkPinkColor, HTMLPinkLightPinkColor, HTMLPinkHotPinkColor,
  HTMLPinkDeepPinkColor, HTMLPinkPaleVioletRedColor, HTMLPinkMediumVioletRedColor, HTMLRedLightSalmonColor,
  HTMLRedSalmonColor, HTMLRedDarkSalmonColor, HTMLRedLightCoralColor, HTMLRedIndianRedColor,
  HTMLRedCrimsonColor, HTMLRedFirebrickColor, HTMLRedDarkRedColor, HTMLRedRedColor,
  HTMLOrangeOrangeRedColor, HTMLOrangeTomatoColor, HTMLOrangeCoralColor, HTMLOrangeDarkOrangeColor,
  HTMLOrangeOrangeColor, HTMLYellowYellowColor, HTMLYellowLightYellowColor, HTMLYellowLemonChiffonColor,
  HTMLYellowLightGoldenrodYellowColor, HTMLYellowPapayaWhipColor, HTMLYellowMoccasinColor, HTMLYellowPeachPuffColor,
  HTMLYellowPaleGoldenrodColor, HTMLYellowKhakiColor, HTMLYellowDarkKhakiColor, HTMLYellowGoldColor,
  HTMLBrownCornsilkColor, HTMLBrownBlanchedAlmondColor, HTMLBrownBisqueColor, HTMLBrownNavajoWhiteColor,
  HTMLBrownWheatColor, HTMLBrownBurlywoodColor, HTMLBrownTanColor, HTMLBrownRosyBrownColor,
  HTMLBrownSandyBrownColor, HTMLBrownGoldenrodColor, HTMLBrownDarkGoldenrodColor, HTMLBrownPeruColor,
  HTMLBrownChocolateColor, HTMLBrownSaddleBrownColor, HTMLBrownSiennaColor, HTMLBrownBrownColor,
  HTMLBrownMaroonColor, HTMLGreenDarkOliveGreenColor, HTMLGreenOliveColor, HTMLGreenOliveDrabColor,
  HTMLGreenYellowGreenColor, HTMLGreenLimeGreenColor, HTMLGreenLimeColor, HTMLGreenLawnGreenColor,
  HTMLGreenChartreuseColor, HTMLGreenGreenYellowColor, HTMLGreenSpringGreenColor, HTMLGreenMediumSpringGreenColor,
  HTMLGreenLightGreenColor, HTMLGreenPaleGreenColor, HTMLGreenDarkSeaGreenColor, HTMLGreenMediumAquamarineColor,
  HTMLGreenMediumSeaGreenColor, HTMLGreenSeaGreenColor, HTMLGreenForestGreenColor, HTMLGreenGreenColor,
  HTMLGreenDarkGreenColor, HTMLCyanAquaColor, HTMLCyanCyanColor, HTMLCyanLightCyanColor,
  HTMLCyanPaleTurquoiseColor, HTMLCyanAquamarineColor, HTMLCyanTurquoiseColor, HTMLCyanMediumTurquoiseColor,
  HTMLCyanDarkTurquoiseColor, HTMLCyanLightSeaGreenColor, HTMLCyanCadetBlueColor, HTMLCyanDarkCyanColor,
  HTMLCyanTealColor, HTMLBlueLightSteelBlueColor, HTMLBluePowderBlueColor, HTMLBlueLightBlueColor,
  HTMLBlueSkyBlueColor, HTMLBlueLightSkyBlueColor, HTMLBlueDeepSkyBlueColor, HTMLBlueDodgerBlueColor,
  HTMLBlueCornflowerBlueColor, HTMLBlueSteelBlueColor, HTMLBlueRoyalBlueColor, HTMLBlueBlueColor,
  HTMLBlueMediumBlueColor, HTMLBlueDarkBlueColor, HTMLBlueNavyColor, HTMLBlueMidnightBlueColor,
  HTMLPurpleLavenderColor, HTMLPurpleThistleColor, HTMLPurplePlumColor, HTMLPurpleVioletColor,
  HTMLPurpleOrchidColor, HTMLPurpleFuchsiaColor, HTMLPurpleMagentaColor, HTMLPurpleMediumOrchidColor,
  HTMLPurpleMediumPurpleColor, HTMLPurpleBlueVioletColor, HTMLPurpleDarkVioletColor, HTMLPurpleDarkOrchidColor,
  HTMLPurpleDarkMagentaColor, HTMLPurplePurpleColor, HTMLPurpleIndigoColor, HTMLPurpleDarkSlateBlueColor,
  HTMLPurpleSlateBlueColor, HTMLPurpleMediumSlateBlueColor, HTMLWhiteWhiteColor, HTMLWhiteSnowColor,
  HTMLWhiteHoneydewColor, HTMLWhiteMintCreamColor, HTMLWhiteAzureColor, HTMLWhiteAliceBlueColor,
  HTMLWhiteGhostWhiteColor, HTMLWhiteWhiteSmokeColor, HTMLWhiteSeashellColor, HTMLWhiteBeigeColor,
  HTMLWhiteOldLaceColor, HTMLWhiteFloralWhiteColor, HTMLWhiteIvoryColor, HTMLWhiteAntiqueWhiteColor,
  HTMLWhiteLinenColor, HTMLWhiteLavenderBlushColor, HTMLWhiteMistyRoseColor, HTMLGrayGainsboroColor,
  HTMLGrayLightGrayColor, HTMLGraySilverColor, HTMLGrayDarkGrayColor, HTMLGrayGrayColor,
  HTMLGrayDimGrayColor, HTMLGrayLightSlateGrayColor, HTMLGraySlateGrayColor, HTMLGrayDarkSlateGrayColor,
  HTMLGrayBlackColor, NoneColor
}
 

Signals

void lineChanged ()
 
void firstEndTypeChanged ()
 
void secondEndTypeChanged ()
 
void firstEndLengthChanged ()
 
void secondEndLengthChanged ()
 

Public Member Functions

 PartLine (QETElementEditor *, QGraphicsItem *=nullptr)
 PartLine::PartLine Constructor. More...
 
 ~PartLine () override
 Destructeur. More...
 
int type () const override
 
void paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *=nullptr) override
 PartLine::paint Draw this line. More...
 
QString name () const override
 
QString xmlName () const override
 
const QDomElement toXml (QDomDocument &) const override
 PartLine::toXml Export this line in xml. More...
 
void fromXml (const QDomElement &) override
 PartLine::fromXml Import the properties of this line from a xml element. More...
 
virtual QPointF sceneP1 () const
 PartLine::sceneP1. More...
 
virtual QPointF sceneP2 () const
 PartLine::sceneP2. More...
 
QPainterPath shape () const override
 PartLine::shape. More...
 
QPainterPath shadowShape () const override
 
QRectF boundingRect () const override
 PartLine::boundingRect. More...
 
bool isUseless () const override
 PartLine::isUseless. More...
 
QRectF sceneGeometricRect () const override
 PartLine::sceneGeometricRect. More...
 
void startUserTransformation (const QRectF &) override
 PartLine::startUserTransformation Start the user-induced transformation, provided this primitive is contained within the initial_selection_rect bounding rectangle. More...
 
void handleUserTransformation (const QRectF &, const QRectF &) override
 PartLine::handleUserTransformation Handle the user-induced transformation from initial_selection_rect to new_selection_rect. More...
 
QLineF line () const
 
void setLine (const QLineF &line)
 
Qet::EndType firstEndType () const
 
void setFirstEndType (const Qet::EndType &et)
 
Qet::EndType secondEndType () const
 
void setSecondEndType (const Qet::EndType &et)
 
qreal firstEndLength () const
 
void setFirstEndLength (const qreal &l)
 
qreal secondEndLength () const
 
void setSecondEndLength (const qreal &l)
 
- 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
 
virtual void setHandlerColor (QPointF, const QColor &)
 
virtual void resetAllHandlerColor ()
 
- Public Member Functions inherited from CustomElementPart
 CustomElementPart (QETElementEditor *editor)
 CustomElementPart Constructor. More...
 
virtual ~CustomElementPart ()
 ~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
 

Static Public Member Functions

static uint requiredLengthForEndType (const Qet::EndType &)
 PartLine::requiredLengthForEndType. More...
 
static QList< QPointF > fourEndPoints (const QPointF &, const QPointF &, const qreal &)
 PartLine::fourEndPoints Return the four interesting point needed to draw the shape at extremity of line (circle, diamond, arrow, triangle) This points are in order : O : point on the line, at a distance 'length' of the extremity A : point on the line at a 'length' of 2x the extremity length B : point at a distance of length O - O is the projection of B on the line C : point at a distance of length O - O is the projection of C on the line. More...
 
- 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

QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 PartLine::itemChange. More...
 
bool sceneEventFilter (QGraphicsItem *watched, QEvent *event) override
 PartLine::sceneEventFilter. 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 > &)
 

Properties

Qet::EndType end1
 
Qet::EndType end2
 
qreal length1
 
qreal length2
 
QLineF line
 
- Properties inherited from CustomElementGraphicPart
LineStyle line_style
 
LineWeight line_weight
 
Filling filling
 
Color color
 
bool antialias
 

Private Member Functions

 PartLine (const PartLine &)
 
void adjusteHandlerPos ()
 PartLine::adjusteHandlerPos Adjust the position of the handler item. More...
 
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
 PartLine::handlerMousePressEvent. More...
 
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
 PartLine::handlerMouseMoveEvent. More...
 
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
 PartLine::handlerMouseReleaseEvent. More...
 
void sceneSelectionChanged ()
 PartLine::sceneSelectionChanged When the scene selection change, if there are several primitive selected, we remove the handler of this item. More...
 
void addHandler ()
 PartLine::addHandler Add handlers for this item. More...
 
void removeHandler ()
 PartLine::removeHandler Remove the handlers of this item. More...
 
QPainterPath path () const
 PartLine::path. More...
 
QList< QPointF > fourShapePoints () const
 PartLine::fourShapePoints. More...
 
QRectF firstEndCircleRect () const
 PartLine::firstEndCircleRect. More...
 
QRectF secondEndCircleRect () const
 PartLine::secondEndCircleRect. More...
 
void debugPaint (QPainter *)
 PartLine::debugPaint Display several composante of the drawing -the bounding rect -special points at each extremity -the quadrature of the circle at each extremity, even if itself is an other type. More...
 

Private Attributes

Qet::EndType first_end
 
qreal first_length
 
Qet::EndType second_end
 
qreal second_length
 
QList< QPointF > saved_points_
 
QLineF m_line
 
int m_vector_index = -1
 
QPropertyUndoCommandm_undo_command
 
QVector< QetGraphicsHandlerItem * > m_handler_vector
 

Additional Inherited Members

- Protected Attributes inherited from CustomElementGraphicPart
bool m_hovered
 

Detailed Description

This class represents a line primitive which may be used to compose the drawing of an electrical element within the element editor. Lines may have specific visual ends (e.g. arrows) through the setFirstEndType and setSecondEndType methods. Their size can be defined using the setFirstEndLength and setSecondEndLength methods. Please note ends are not drawn if the required length for their drawing is longer than the line itself. In case there is room for a single end only, the first one get priority.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Constructor & Destructor Documentation

◆ PartLine() [1/2]

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

PartLine::PartLine Constructor.

Parameters
editor: QETElementEditor of this part
parent: parent item

◆ ~PartLine()

PartLine::~PartLine ( )
override

Destructeur.

Here is the call graph for this function:

◆ PartLine() [2/2]

PartLine::PartLine ( const PartLine )
private

Member Function Documentation

◆ addHandler()

void PartLine::addHandler ( )
private

PartLine::addHandler Add handlers for this item.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ adjusteHandlerPos()

void PartLine::adjusteHandlerPos ( )
private

PartLine::adjusteHandlerPos Adjust the position of the handler item.

Here is the caller graph for this function:

◆ boundingRect()

QRectF PartLine::boundingRect ( ) const
override

PartLine::boundingRect.

Returns
the bounding rect of this part
Here is the call graph for this function:
Here is the caller graph for this function:

◆ debugPaint()

void PartLine::debugPaint ( QPainter *  painter)
private

PartLine::debugPaint Display several composante of the drawing -the bounding rect -special points at each extremity -the quadrature of the circle at each extremity, even if itself is an other type.

Parameters
painter
Here is the call graph for this function:

◆ firstEndCircleRect()

QRectF PartLine::firstEndCircleRect ( ) const
private

PartLine::firstEndCircleRect.

Returns
the rectangle bordering the entirety of the first extremity
Here is the call graph for this function:
Here is the caller graph for this function:

◆ firstEndLength()

qreal PartLine::firstEndLength ( ) const
inline

◆ firstEndLengthChanged

void PartLine::firstEndLengthChanged ( )
signal
Here is the caller graph for this function:

◆ firstEndType()

Qet::EndType PartLine::firstEndType ( ) const
inline

◆ firstEndTypeChanged

void PartLine::firstEndTypeChanged ( )
signal
Here is the caller graph for this function:

◆ fourEndPoints()

QList< QPointF > PartLine::fourEndPoints ( const QPointF &  end_point,
const QPointF &  other_point,
const qreal &  length 
)
static

PartLine::fourEndPoints Return the four interesting point needed to draw the shape at extremity of line (circle, diamond, arrow, triangle) This points are in order : O : point on the line, at a distance 'length' of the extremity A : point on the line at a 'length' of 2x the extremity length B : point at a distance of length O - O is the projection of B on the line C : point at a distance of length O - O is the projection of C on the line.

Parameters
end_point: The concerned extremity
other_point: other needed point to define the line
length: length to use between the extremity and the point O
Returns
Here is the caller graph for this function:

◆ fourShapePoints()

QList< QPointF > PartLine::fourShapePoints ( ) const
private

PartLine::fourShapePoints.

Returns
a list with the two points that delimite the line
  • the four points surrounding these two points

◆ fromXml()

void PartLine::fromXml ( const QDomElement &  qde)
overridevirtual

PartLine::fromXml Import the properties of this line from a xml element.

Parameters
qde: Xml document to use

Implements CustomElementPart.

Here is the call graph for this function:

◆ handlerMouseMoveEvent()

void PartLine::handlerMouseMoveEvent ( QetGraphicsHandlerItem qghi,
QGraphicsSceneMouseEvent *  event 
)
private

PartLine::handlerMouseMoveEvent.

Parameters
qghi
event
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlerMousePressEvent()

void PartLine::handlerMousePressEvent ( QetGraphicsHandlerItem qghi,
QGraphicsSceneMouseEvent *  event 
)
private

PartLine::handlerMousePressEvent.

Parameters
qghi
event
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlerMouseReleaseEvent()

void PartLine::handlerMouseReleaseEvent ( QetGraphicsHandlerItem qghi,
QGraphicsSceneMouseEvent *  event 
)
private

PartLine::handlerMouseReleaseEvent.

Parameters
qghi
event
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleUserTransformation()

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

PartLine::handleUserTransformation Handle the user-induced transformation from initial_selection_rect to new_selection_rect.

Parameters
initial_selection_rect
new_selection_rect

Implements CustomElementPart.

Here is the call graph for this function:

◆ isUseless()

bool PartLine::isUseless ( ) const
overridevirtual

PartLine::isUseless.

Returns
true if this part is irrelevant and does not deserve to be Retained / registered. A line is relevant when is two point is different

Implements CustomElementPart.

Here is the caller graph for this function:

◆ itemChange()

QVariant PartLine::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
overrideprotected

PartLine::itemChange.

Parameters
change
value
Returns
Here is the call graph for this function:

◆ line()

QLineF PartLine::line ( ) const

◆ lineChanged

void PartLine::lineChanged ( )
signal
Here is the caller graph for this function:

◆ name()

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

Implements CustomElementPart.

◆ paint()

void PartLine::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  options,
QWidget *  widget = nullptr 
)
override

PartLine::paint Draw this line.

Parameters
painter
options
widget
Here is the call graph for this function:

◆ path()

QPainterPath PartLine::path ( ) const
private

PartLine::path.

Returns
this line has a QPainterPath. It's notably use when this line have an end type (circle, triangle etc....), because return a QPainterPath with end already draw. Else if there isn't an end type get P1 and P2 of line is better (faster).
Returns
true si cette partie n'est pas pertinente et ne merite pas d'etre conservee / enregistree. Une ligne est pertinente des lors que ses deux points sont differents
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeHandler()

void PartLine::removeHandler ( )
private

PartLine::removeHandler Remove the handlers of this item.

Here is the caller graph for this function:

◆ requiredLengthForEndType()

uint PartLine::requiredLengthForEndType ( const Qet::EndType end_type)
static

PartLine::requiredLengthForEndType.

Parameters
end_type
Returns
the number of "length" needed to draw a extremity of type Qet::EndType.
Here is the caller graph for this function:

◆ sceneEventFilter()

bool PartLine::sceneEventFilter ( QGraphicsItem *  watched,
QEvent *  event 
)
overrideprotected

PartLine::sceneEventFilter.

Parameters
watched
event
Returns
Here is the call graph for this function:

◆ sceneGeometricRect()

QRectF PartLine::sceneGeometricRect ( ) const
overridevirtual

PartLine::sceneGeometricRect.

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.

Here is the call graph for this function:

◆ sceneP1()

QPointF PartLine::sceneP1 ( ) const
virtual

PartLine::sceneP1.

Returns
the point p1 in scene coordinate
Here is the caller graph for this function:

◆ sceneP2()

QPointF PartLine::sceneP2 ( ) const
virtual

PartLine::sceneP2.

Returns
the point p2 in scen coordinate
Here is the caller graph for this function:

◆ sceneSelectionChanged()

void PartLine::sceneSelectionChanged ( )
private

PartLine::sceneSelectionChanged When the scene selection change, if there are several primitive selected, we remove the handler of this item.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ secondEndCircleRect()

QRectF PartLine::secondEndCircleRect ( ) const
private

PartLine::secondEndCircleRect.

Returns
the rectangle bordering the entirety of the second extremity
Here is the call graph for this function:
Here is the caller graph for this function:

◆ secondEndLength()

qreal PartLine::secondEndLength ( ) const
inline

◆ secondEndLengthChanged

void PartLine::secondEndLengthChanged ( )
signal
Here is the caller graph for this function:

◆ secondEndType()

Qet::EndType PartLine::secondEndType ( ) const
inline

◆ secondEndTypeChanged

void PartLine::secondEndTypeChanged ( )
signal
Here is the caller graph for this function:

◆ setFirstEndLength()

void PartLine::setFirstEndLength ( const qreal &  l)

◆ setFirstEndType()

void PartLine::setFirstEndType ( const Qet::EndType et)

◆ setLine()

void PartLine::setLine ( const QLineF &  line)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSecondEndLength()

void PartLine::setSecondEndLength ( const qreal &  l)

◆ setSecondEndType()

void PartLine::setSecondEndType ( const Qet::EndType et)

◆ shadowShape()

QPainterPath PartLine::shadowShape ( ) const
overridevirtual

Implements CustomElementGraphicPart.

Here is the call graph for this function:

◆ shape()

QPainterPath PartLine::shape ( ) const
override

PartLine::shape.

Returns
the shape of this item
Here is the call graph for this function:
Here is the caller graph for this function:

◆ startUserTransformation()

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

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

Parameters
initial_selection_rect

Implements CustomElementPart.

Here is the call graph for this function:

◆ toXml()

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

PartLine::toXml Export this line in xml.

Parameters
xml_document: Xml document to use for create the xml element.
Returns
an xml element that describe this line

Implements CustomElementPart.

Here is the call graph for this function:

◆ type()

int PartLine::type ( ) const
inlineoverride

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

Returns
the QGraphicsItem type

◆ xmlName()

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

Implements CustomElementPart.

Member Data Documentation

◆ first_end

Qet::EndType PartLine::first_end
private

◆ first_length

qreal PartLine::first_length
private

◆ m_handler_vector

QVector<QetGraphicsHandlerItem *> PartLine::m_handler_vector
private

◆ m_line

QLineF PartLine::m_line
private

◆ m_undo_command

QPropertyUndoCommand* PartLine::m_undo_command
private

◆ m_vector_index

int PartLine::m_vector_index = -1
private

◆ saved_points_

QList<QPointF> PartLine::saved_points_
private

◆ second_end

Qet::EndType PartLine::second_end
private

◆ second_length

qreal PartLine::second_length
private

Property Documentation

◆ end1

Qet::EndType PartLine::end1
readwrite

◆ end2

Qet::EndType PartLine::end2
readwrite

◆ length1

qreal PartLine::length1
readwrite

◆ length2

qreal PartLine::length2
readwrite

◆ line

QLineF PartLine::line
readwrite

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