LibrePCB Developers Documentation
PrimitivePathGraphicsItem Class Reference

The PrimitivePathGraphicsItem class. More...

#include <primitivepathgraphicsitem.h>

+ Inheritance diagram for PrimitivePathGraphicsItem:
+ Collaboration diagram for PrimitivePathGraphicsItem:

Public Types

enum class  ShapeMode
 

Public Member Functions

 PrimitivePathGraphicsItem (const PrimitivePathGraphicsItem &other)=delete
 
 PrimitivePathGraphicsItem (QGraphicsItem *parent=nullptr) noexcept
 
virtual ~PrimitivePathGraphicsItem () noexcept
 
void setPosition (const Point &pos) noexcept
 
void setRotation (const Angle &rot) noexcept
 
void setMirrored (bool mirrored) noexcept
 
void setPath (const QPainterPath &path) noexcept
 
void setLineWidth (const UnsignedLength &width) noexcept
 
void setLineLayer (const std::shared_ptr< GraphicsLayer > &layer) noexcept
 
void setFillLayer (const std::shared_ptr< GraphicsLayer > &layer) noexcept
 
void setLighterColors (bool lighter) noexcept
 
void setShapeMode (ShapeMode mode) noexcept
 
QRectF boundingRect () const noexcept override
 
QPainterPath shape () const noexcept override
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) noexcept override
 
PrimitivePathGraphicsItemoperator= (const PrimitivePathGraphicsItem &rhs)=delete
 

Protected Attributes

bool mMirror
 
std::shared_ptr< GraphicsLayermLineLayer
 
std::shared_ptr< GraphicsLayermFillLayer
 
bool mLighterColors
 
ShapeMode mShapeMode
 
QPen mPen
 
QPen mPenHighlighted
 
QBrush mBrush
 
QBrush mBrushHighlighted
 
QPainterPath mPainterPath
 
QRectF mBoundingRect
 
qreal mBoundingRectMarginPx
 
QPainterPath mShape
 
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
 

Private Member Functions

void layerEdited (const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
 
void updateColors () noexcept
 
void updateBoundingRectAndShape () noexcept
 
void updateVisibility () noexcept
 
QColor convertColor (const QColor &color) const noexcept
 

Detailed Description

Member Enumeration Documentation

◆ ShapeMode

enum class ShapeMode
strong
Enumerator
None 

No shape is set (empty area).

FilledOutline 

Only the area within the painter path is used as shape.

StrokeAndAreaByLayer 

Both the line stroke (with its specified width) and the filled area are used as shape, if the corresponding layers are set and visible.

Constructor & Destructor Documentation

◆ PrimitivePathGraphicsItem() [1/2]

◆ PrimitivePathGraphicsItem() [2/2]

PrimitivePathGraphicsItem ( QGraphicsItem *  parent = nullptr)
explicitnoexcept

◆ ~PrimitivePathGraphicsItem()

~PrimitivePathGraphicsItem ( )
virtualnoexcept

Member Function Documentation

◆ setPosition()

void setPosition ( const Point pos)
noexcept

◆ setRotation()

void setRotation ( const Angle rot)
noexcept

◆ setMirrored()

void setMirrored ( bool  mirrored)
noexcept

◆ setPath()

void setPath ( const QPainterPath &  path)
noexcept
+ Here is the caller graph for this function:

◆ setLineWidth()

void setLineWidth ( const UnsignedLength width)
noexcept
+ Here is the caller graph for this function:

◆ setLineLayer()

void setLineLayer ( const std::shared_ptr< GraphicsLayer > &  layer)
noexcept
+ Here is the caller graph for this function:

◆ setFillLayer()

void setFillLayer ( const std::shared_ptr< GraphicsLayer > &  layer)
noexcept
+ Here is the caller graph for this function:

◆ setLighterColors()

void setLighterColors ( bool  lighter)
noexcept

◆ setShapeMode()

void setShapeMode ( ShapeMode  mode)
noexcept

◆ boundingRect()

QRectF boundingRect ( ) const
inlineoverridenoexcept

◆ shape()

QPainterPath shape ( ) const
overridenoexcept
+ Here is the caller graph for this function:

◆ paint()

void paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
)
overridenoexcept
+ Here is the caller graph for this function:

◆ operator=()

PrimitivePathGraphicsItem & operator= ( const PrimitivePathGraphicsItem rhs)
delete

◆ layerEdited()

void layerEdited ( const GraphicsLayer layer,
GraphicsLayer::Event  event 
)
privatenoexcept

◆ updateColors()

void updateColors ( )
privatenoexcept
+ Here is the call graph for this function:

◆ updateBoundingRectAndShape()

void updateBoundingRectAndShape ( )
privatenoexcept
+ Here is the call graph for this function:

◆ updateVisibility()

void updateVisibility ( )
privatenoexcept

◆ convertColor()

QColor convertColor ( const QColor &  color) const
privatenoexcept
+ Here is the caller graph for this function:

Member Data Documentation

◆ mMirror

bool mMirror
protected

◆ mLineLayer

std::shared_ptr<GraphicsLayer> mLineLayer
protected

◆ mFillLayer

std::shared_ptr<GraphicsLayer> mFillLayer
protected

◆ mLighterColors

bool mLighterColors
protected

◆ mShapeMode

ShapeMode mShapeMode
protected

◆ mPen

QPen mPen
protected

◆ mPenHighlighted

QPen mPenHighlighted
protected

◆ mBrush

QBrush mBrush
protected

◆ mBrushHighlighted

QBrush mBrushHighlighted
protected

◆ mPainterPath

QPainterPath mPainterPath
protected

◆ mBoundingRect

QRectF mBoundingRect
protected

◆ mBoundingRectMarginPx

qreal mBoundingRectMarginPx
protected

◆ mShape

QPainterPath mShape
protected

◆ mOnLayerEditedSlot

GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
protected

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