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

The PartPolygon class This class represents a polygon primitive which may be used to compose the drawing of an electrical element within the element editor. More...

#include <partpolygon.h>

Inheritance diagram for PartPolygon:
Inheritance graph
Collaboration diagram for PartPolygon:
Collaboration graph

Public Types

enum  { Type = UserType + 1105 }
 
- 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 closedChange ()
 
void polygonChanged ()
 

Public Member Functions

 PartPolygon (QETElementEditor *editor, QGraphicsItem *parent=nullptr)
 PartPolygon::PartPolygon Constructor. More...
 
 ~PartPolygon () override
 PartPolygon::~PartPolygon. More...
 
int type () const override
 
void paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
 PartPolygon::paint Draw this polygon. More...
 
QString name () const override
 
QString xmlName () const override
 
void fromXml (const QDomElement &) override
 PartPolygon::fromXml Import the properties of this polygon from a xml element. More...
 
const QDomElement toXml (QDomDocument &) const override
 PartPolygon::toXml Export this polygin in xml. More...
 
QPainterPath shape () const override
 PartPolygon::shape. More...
 
QPainterPath shadowShape () const override
 
QRectF boundingRect () const override
 PartPolygon::boundingRect. More...
 
bool isUseless () const override
 PartPolygon::isUseless. More...
 
QRectF sceneGeometricRect () const override
 PartPolygon::sceneGeometricRect. More...
 
void startUserTransformation (const QRectF &) override
 PartPolygon::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
 PartPolygon::handleUserTransformation Handle the user-induced transformation from initial_selection_rect to new_selection_rect. More...
 
QET::ScalingMethod preferredScalingMethod () const override
 PartPolygon::preferredScalingMethod 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. More...
 
QPolygonF polygon () const
 PartPolygon::polygon. More...
 
void setPolygon (const QPolygonF &polygon)
 PartPolygon::setPolygon Sets the item's polygon to be the given polygon. More...
 
void addPoint (const QPointF &point)
 PartPolygon::addPoint Add new point to polygon. More...
 
void setLastPoint (const QPointF &point)
 PartPolygon::setLastPoint Set the last point of polygon to point. More...
 
void removeLastPoint ()
 PartPolygon::removeLastPoint Remove the last point of polygon. More...
 
bool isClosed () const
 
void setClosed (bool close)
 
void setHandlerColor (QPointF pos, const QColor &color) final
 PartPolygon::setHandlerColor Set the handler at pos pos (in polygon coordinate) to color color. More...
 
void resetAllHandlerColor () final
 PartPolygon::resetAllHandlerColor Reset the color of every handlers. More...
 
- 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)
 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 ()
 

Protected Member Functions

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

bool closed
 
QPolygonF polygon
 
- Properties inherited from CustomElementGraphicPart
LineStyle line_style
 
LineWeight line_weight
 
Filling filling
 
Color color
 
bool antialias
 

Private Member Functions

 PartPolygon (const PartPolygon &)
 
void adjusteHandlerPos ()
 PartPolygon::adjusteHandlerPos. More...
 
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
 PartPolygon::handlerMousePressEvent. More...
 
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
 PartPolygon::handlerMouseMoveEvent. More...
 
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
 PartPolygon::handlerMouseReleaseEvent. More...
 
void sceneSelectionChanged ()
 PartPolygon::sceneSelectionChanged When the scene selection change, if there are several primitive selected, we remove the handler of this item. More...
 
void addHandler ()
 PartPolygon::addHandler Add handlers for this item. More...
 
void removeHandler ()
 PartPolygon::removeHandler Remove the handlers of this item. More...
 
void insertPoint ()
 PartPolygon::insertPoint Insert a point in this polygone. More...
 
void removePoint ()
 PartPolygon::removePoint remove a point on this polygon. More...
 

Private Attributes

bool m_closed
 
QList< QPointF > saved_points_
 
QPolygonF m_polygon
 
QPropertyUndoCommandm_undo_command
 
int m_vector_index = -1
 
QVector< QetGraphicsHandlerItem * > m_handler_vector
 
QAction * m_insert_point
 
QAction * m_remove_point
 
QPointF m_context_menu_pos
 

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 Attributes inherited from CustomElementGraphicPart
bool m_hovered
 

Detailed Description

The PartPolygon class This class represents a polygon primitive which may be used to compose the drawing of an electrical element within the element editor.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Constructor & Destructor Documentation

◆ PartPolygon() [1/2]

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

PartPolygon::PartPolygon Constructor.

Parameters
editor: editor of this item
parent: parent item
Here is the call graph for this function:

◆ ~PartPolygon()

PartPolygon::~PartPolygon ( )
override

PartPolygon::~PartPolygon.

Here is the call graph for this function:

◆ PartPolygon() [2/2]

PartPolygon::PartPolygon ( const PartPolygon )
private

Member Function Documentation

◆ addHandler()

void PartPolygon::addHandler ( )
private

PartPolygon::addHandler Add handlers for this item.

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

◆ addPoint()

void PartPolygon::addPoint ( const QPointF &  point)

PartPolygon::addPoint Add new point to polygon.

Parameters
point

◆ adjusteHandlerPos()

void PartPolygon::adjusteHandlerPos ( )
private

PartPolygon::adjusteHandlerPos.

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

◆ boundingRect()

QRectF PartPolygon::boundingRect ( ) const
override

PartPolygon::boundingRect.

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

◆ closedChange

void PartPolygon::closedChange ( )
signal
Here is the caller graph for this function:

◆ contextMenuEvent()

void PartPolygon::contextMenuEvent ( QGraphicsSceneContextMenuEvent *  event)
overrideprotected
Here is the call graph for this function:

◆ fromXml()

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

PartPolygon::fromXml Import the properties of this polygon from a xml element.

Parameters
qde: Xml document to use

Implements CustomElementPart.

Here is the call graph for this function:

◆ handlerMouseMoveEvent()

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

PartPolygon::handlerMouseMoveEvent.

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

◆ handlerMousePressEvent()

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

PartPolygon::handlerMousePressEvent.

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

◆ handlerMouseReleaseEvent()

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

PartPolygon::handlerMouseReleaseEvent.

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

◆ handleUserTransformation()

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

PartPolygon::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:

◆ insertPoint()

void PartPolygon::insertPoint ( )
private

PartPolygon::insertPoint Insert a point in this polygone.

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

◆ isClosed()

bool PartPolygon::isClosed ( ) const
inline
Here is the caller graph for this function:

◆ isUseless()

bool PartPolygon::isUseless ( ) const
overridevirtual

PartPolygon::isUseless.

Returns
true if this part is irrelevant and does not deserve to be Retained / registered. A polygon is relevant when he have 2 differents points

Implements CustomElementPart.

◆ itemChange()

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

PartPolygon::itemChange.

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

◆ name()

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

Implements CustomElementPart.

◆ paint()

void PartPolygon::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  options,
QWidget *  widget 
)
override

PartPolygon::paint Draw this polygon.

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

◆ polygon()

QPolygonF PartPolygon::polygon ( ) const

PartPolygon::polygon.

Returns
the item's polygon, or an empty polygon if no polygon has been set.

◆ polygonChanged

void PartPolygon::polygonChanged ( )
signal
Here is the caller graph for this function:

◆ preferredScalingMethod()

QET::ScalingMethod PartPolygon::preferredScalingMethod ( ) const
overridevirtual

PartPolygon::preferredScalingMethod 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.

Returns
: This reimplementation systematically returns QET::RoundScaleRatios.

Reimplemented from CustomElementPart.

◆ removeHandler()

void PartPolygon::removeHandler ( )
private

PartPolygon::removeHandler Remove the handlers of this item.

Here is the caller graph for this function:

◆ removeLastPoint()

void PartPolygon::removeLastPoint ( )

PartPolygon::removeLastPoint Remove the last point of polygon.

Here is the caller graph for this function:

◆ removePoint()

void PartPolygon::removePoint ( )
private

PartPolygon::removePoint remove a point on this polygon.

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

◆ resetAllHandlerColor()

void PartPolygon::resetAllHandlerColor ( )
finalvirtual

PartPolygon::resetAllHandlerColor Reset the color of every handlers.

Reimplemented from CustomElementGraphicPart.

Here is the caller graph for this function:

◆ sceneEventFilter()

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

PartPolygon::sceneEventFilter.

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

◆ sceneGeometricRect()

QRectF PartPolygon::sceneGeometricRect ( ) const
overridevirtual

PartPolygon::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.

◆ sceneSelectionChanged()

void PartPolygon::sceneSelectionChanged ( )
private

PartPolygon::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:

◆ setClosed()

void PartPolygon::setClosed ( bool  close)
Here is the caller graph for this function:

◆ setHandlerColor()

void PartPolygon::setHandlerColor ( QPointF  pos,
const QColor &  color 
)
finalvirtual

PartPolygon::setHandlerColor Set the handler at pos pos (in polygon coordinate) to color color.

Parameters
pos
color

Reimplemented from CustomElementGraphicPart.

Here is the caller graph for this function:

◆ setLastPoint()

void PartPolygon::setLastPoint ( const QPointF &  point)

PartPolygon::setLastPoint Set the last point of polygon to point.

Parameters
point

◆ setPolygon()

void PartPolygon::setPolygon ( const QPolygonF &  polygon)

PartPolygon::setPolygon Sets the item's polygon to be the given polygon.

Parameters
polygon
Here is the call graph for this function:

◆ shadowShape()

QPainterPath PartPolygon::shadowShape ( ) const
overridevirtual

Implements CustomElementGraphicPart.

Here is the call graph for this function:

◆ shape()

QPainterPath PartPolygon::shape ( ) const
override

PartPolygon::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 PartPolygon::startUserTransformation ( const QRectF &  initial_selection_rect)
overridevirtual

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

Parameters
initial_selection_rect

Implements CustomElementPart.

◆ toXml()

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

PartPolygon::toXml Export this polygin in xml.

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

Implements CustomElementPart.

Here is the call graph for this function:

◆ type()

int PartPolygon::type ( ) const
inlineoverride

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

Returns
the QGraphicsItem type

◆ xmlName()

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

Implements CustomElementPart.

Member Data Documentation

◆ m_closed

bool PartPolygon::m_closed
private

◆ m_context_menu_pos

QPointF PartPolygon::m_context_menu_pos
private

◆ m_handler_vector

QVector<QetGraphicsHandlerItem *> PartPolygon::m_handler_vector
private

◆ m_insert_point

QAction* PartPolygon::m_insert_point
private

◆ m_polygon

QPolygonF PartPolygon::m_polygon
private

◆ m_remove_point

QAction * PartPolygon::m_remove_point
private

◆ m_undo_command

QPropertyUndoCommand* PartPolygon::m_undo_command
private

◆ m_vector_index

int PartPolygon::m_vector_index = -1
private

◆ saved_points_

QList<QPointF> PartPolygon::saved_points_
private

Property Documentation

◆ closed

bool PartPolygon::closed
readwrite

◆ polygon

QPolygonF PartPolygon::polygon
readwrite

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