Open Source 2D CAD
RPainterPath Class Reference

Extended painter path with a z-level and a pen. More...

#include <RPainterPath.h>

Inheritance diagram for RPainterPath:

Public Types

enum  Mode {
  NoModes = 0x0000, Selected = 0x0001, Highlighted = 0x0002, Invalid = 0x0004,
  FixedPenColor = 0x0008, FixedBrushColor = 0x0010, AutoRegen = 0x0020, AlwaysRegen = 0x0040,
  InheritPen = 0x0080, PixelUnit = 0x0100, NoClipping = 0x0200, PixelWidth = 0x0400,
  NoColorMode = 0x0800, SimplePointDisplay = 0x1000

Public Member Functions

void addArc (const RArc &arc)
void addBox (const RBox &box)
void addLine (const RLine &line)
void addOriginalShape (QSharedPointer< RShape > shape)
void addPath (const RPainterPath &path)
void addPoint (const RVector &position)
void addPolyline (const RPolyline &pl)
void addRect (const QRectF &rect)
 Fixes crashing QPainterPath::addRect. More...
void addRect (double x1, double y1, double x2, double y2)
void addShape (QSharedPointer< RShape > shape)
void addSpline (const RSpline &spline)
void appendPath (const RPainterPath &path)
void closeSubpath ()
bool containsPoint (const RVector &v) const
int countOriginalShapes () const
void cubicTo (const RVector &cp1, const RVector &cp2, const RVector &v)
void cubicTo (qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y, qreal endPtx, qreal endPty)
bool getAlwaysRegen () const
bool getAutoRegen () const
RBox getBoundingBox () const
QBrush getBrush () const
RVector getCurrentPosition () const
double getDistanceTo (const RVector &point) const
int getElementCount () const
RVector getEndPoint () const
double getFeatureSize () const
bool getInheritPen () const
bool getMode (RPainterPath::Mode mode) const
bool getNoClipping () const
bool getNoColorMode () const
QSharedPointer< RShapegetOriginalShape (int i) const
QPen getPen () const
double getPixelSizeHint () const
bool getPixelUnit () const
bool getPixelWidth () const
QList< RVectorgetPoints () const
QList< QSharedPointer< RShape > > getShapes () const
bool getSimplePointDisplay () const
RVector getStartPoint () const
QPainterPath::ElementType getTypeAt (int i) const
double getXAt (int i) const
double getYAt (int i) const
int getZLevel () const
bool hasOriginalShapes () const
bool hasPoints ()
bool isAtPosition (const RVector &p, double tolerance=RS::PointTolerance) const
bool isEmpty () const
bool isFixedBrushColor () const
bool isFixedPenColor () const
bool isHighlighted () const
bool isSane () const
bool isSelected () const
bool isValid () const
void lineTo (const QPointF &p)
void lineTo (const RVector &v)
void lineTo (qreal x, qreal y)
void move (const RVector &offset)
void moveTo (const QPointF &p)
void moveTo (const RVector &v)
void moveTo (qreal x, qreal y)
void moveToOrNop (const RVector &v)
void quadTo (const RVector &cp, const RVector &v)
void quadTo (qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty)
void rotate (double angle)
 RPainterPath ()
 Copyright (c) 2011-2018 by Andrew Mustun. More...
 RPainterPath (const QPainterPath &path)
 RPainterPath (const RPainterPath &other)
void scale (double fx, double fy)
void setAlwaysRegen (bool on)
void setAutoRegen (bool on)
void setBrush (const QBrush &b)
void setFeatureSize (double s)
void setFixedBrushColor (bool on)
void setFixedPenColor (bool on)
void setHighlighted (bool on)
void setInheritPen (bool on)
void setMode (RPainterPath::Mode mode, bool on=true)
void setNoClipping (bool on)
void setNoColorMode (bool on)
void setPath (const QPainterPath &path)
void setPen (const QPen &p)
 Sets the pen of this painter path. More...
void setPixelSizeHint (double s)
void setPixelUnit (bool on)
void setPixelWidth (bool on)
void setPoints (const QList< RVector > &p)
void setSelected (bool on)
void setSimplePointDisplay (bool on)
void setValid (bool on)
void setZLevel (int zl)
 Sets the z-level of the painter path. More...
void transform (const QTransform &t)
virtual ~RPainterPath ()

Static Public Member Functions

static RVector getMaxList (QList< RPainterPath > &pps)
static RVector getMinList (QList< RPainterPath > &pps)
static void rotateList (QList< RPainterPath > &pps, double angle)
static void scaleList (QList< RPainterPath > &pps, double fx, double fy)
static void translateList (QList< RPainterPath > &pps, const RVector &offset)

Private Attributes

QBrush brush
double featureSize
Modes modes
QList< QSharedPointer< RShape > > originalShapes
QPen pen
double pixelSizeHint
QList< RVectorpoints
int zLevel

Detailed Description

Extended painter path with a z-level and a pen.

Scriptable:\nThis class is available in script environments.\n
Copyable:\nObjects are cleaned up automatically by the garbage collector of the script engine.\n

Member Enumeration Documentation

◆ Mode


show as selected


show as highlighted


arcs (regen on zoom change)


inherit pen from entity / context


path displayed in pixel (not drawing units)


disable clipping for this path


interpret width in pixels


disable color mode


simple point mode (for points in hatch patterns)

Constructor & Destructor Documentation

◆ RPainterPath() [1/3]

RPainterPath::RPainterPath ( )

Copyright (c) 2011-2018 by Andrew Mustun.

All rights reserved.

This file is part of the QCAD project.

QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with QCAD.

◆ RPainterPath() [2/3]

RPainterPath::RPainterPath ( const QPainterPath &  path)

◆ RPainterPath() [3/3]

RPainterPath::RPainterPath ( const RPainterPath other)

◆ ~RPainterPath()

RPainterPath::~RPainterPath ( )

Member Function Documentation

◆ addArc()

void RPainterPath::addArc ( const RArc arc)

◆ addBox()

void RPainterPath::addBox ( const RBox box)

◆ addLine()

void RPainterPath::addLine ( const RLine line)

◆ addOriginalShape()

void RPainterPath::addOriginalShape ( QSharedPointer< RShape shape)

◆ addPath()

void RPainterPath::addPath ( const RPainterPath path)

◆ addPoint()

void RPainterPath::addPoint ( const RVector position)

◆ addPolyline()

void RPainterPath::addPolyline ( const RPolyline pl)

◆ addRect() [1/2]

void RPainterPath::addRect ( const QRectF &  rect)

Fixes crashing QPainterPath::addRect.

◆ addRect() [2/2]

void RPainterPath::addRect ( double  x1,
double  y1,
double  x2,
double  y2 

◆ addShape()

void RPainterPath::addShape ( QSharedPointer< RShape shape)

◆ addSpline()

void RPainterPath::addSpline ( const RSpline spline)

◆ appendPath()

void RPainterPath::appendPath ( const RPainterPath path)

◆ closeSubpath()

void RPainterPath::closeSubpath ( )

◆ containsPoint()

bool RPainterPath::containsPoint ( const RVector v) const

◆ countOriginalShapes()

int RPainterPath::countOriginalShapes ( ) const

◆ cubicTo() [1/2]

void RPainterPath::cubicTo ( const RVector cp1,
const RVector cp2,
const RVector v 

◆ cubicTo() [2/2]

void RPainterPath::cubicTo ( qreal  ctrlPt1x,
qreal  ctrlPt1y,
qreal  ctrlPt2x,
qreal  ctrlPt2y,
qreal  endPtx,
qreal  endPty 

◆ getAlwaysRegen()

bool RPainterPath::getAlwaysRegen ( ) const

◆ getAutoRegen()

bool RPainterPath::getAutoRegen ( ) const

◆ getBoundingBox()

RBox RPainterPath::getBoundingBox ( ) const

◆ getBrush()

QBrush RPainterPath::getBrush ( ) const

◆ getCurrentPosition()

RVector RPainterPath::getCurrentPosition ( ) const

◆ getDistanceTo()

double RPainterPath::getDistanceTo ( const RVector point) const
Distance from this painter path to the given point.

This can be used for example to find out how close the visual representation of an entity is to the mouse cursor on the screen.

◆ getElementCount()

int RPainterPath::getElementCount ( ) const

◆ getEndPoint()

RVector RPainterPath::getEndPoint ( ) const

◆ getFeatureSize()

double RPainterPath::getFeatureSize ( ) const

◆ getInheritPen()

bool RPainterPath::getInheritPen ( ) const

◆ getMaxList()

RVector RPainterPath::getMaxList ( QList< RPainterPath > &  pps)

◆ getMinList()

RVector RPainterPath::getMinList ( QList< RPainterPath > &  pps)

◆ getMode()

bool RPainterPath::getMode ( RPainterPath::Mode  mode) const

◆ getNoClipping()

bool RPainterPath::getNoClipping ( ) const

◆ getNoColorMode()

bool RPainterPath::getNoColorMode ( ) const

◆ getOriginalShape()

QSharedPointer< RShape > RPainterPath::getOriginalShape ( int  i) const

◆ getPen()

QPen RPainterPath::getPen ( ) const
Pen of this painter path.

◆ getPixelSizeHint()

double RPainterPath::getPixelSizeHint ( ) const

◆ getPixelUnit()

bool RPainterPath::getPixelUnit ( ) const

◆ getPixelWidth()

bool RPainterPath::getPixelWidth ( ) const

◆ getPoints()

QList< RVector > RPainterPath::getPoints ( ) const

◆ getShapes()

QList< QSharedPointer< RShape > > RPainterPath::getShapes ( ) const

◆ getSimplePointDisplay()

bool RPainterPath::getSimplePointDisplay ( ) const

◆ getStartPoint()

RVector RPainterPath::getStartPoint ( ) const

◆ getTypeAt()

QPainterPath::ElementType RPainterPath::getTypeAt ( int  i) const

◆ getXAt()

double RPainterPath::getXAt ( int  i) const

◆ getYAt()

double RPainterPath::getYAt ( int  i) const

◆ getZLevel()

int RPainterPath::getZLevel ( ) const
Z-level of the painter path.

◆ hasOriginalShapes()

bool RPainterPath::hasOriginalShapes ( ) const

◆ hasPoints()

bool RPainterPath::hasPoints ( )

◆ isAtPosition()

bool RPainterPath::isAtPosition ( const RVector p,
double  tolerance = RS::PointTolerance 
) const

◆ isEmpty()

bool RPainterPath::isEmpty ( ) const

◆ isFixedBrushColor()

bool RPainterPath::isFixedBrushColor ( ) const

◆ isFixedPenColor()

bool RPainterPath::isFixedPenColor ( ) const

◆ isHighlighted()

bool RPainterPath::isHighlighted ( ) const

◆ isSane()

bool RPainterPath::isSane ( ) const

◆ isSelected()

bool RPainterPath::isSelected ( ) const

◆ isValid()

bool RPainterPath::isValid ( ) const

◆ lineTo() [1/3]

void RPainterPath::lineTo ( const QPointF &  p)
Non-Scriptable:\nThis function is not available in script environments.\n

◆ lineTo() [2/3]

void RPainterPath::lineTo ( const RVector v)

◆ lineTo() [3/3]

void RPainterPath::lineTo ( qreal  x,
qreal  y 

◆ move()

void RPainterPath::move ( const RVector offset)

◆ moveTo() [1/3]

void RPainterPath::moveTo ( const QPointF &  p)
Non-Scriptable:\nThis function is not available in script environments.\n

◆ moveTo() [2/3]

void RPainterPath::moveTo ( const RVector v)

◆ moveTo() [3/3]

void RPainterPath::moveTo ( qreal  x,
qreal  y 

◆ moveToOrNop()

void RPainterPath::moveToOrNop ( const RVector v)

◆ quadTo() [1/2]

void RPainterPath::quadTo ( const RVector cp,
const RVector v 

◆ quadTo() [2/2]

void RPainterPath::quadTo ( qreal  ctrlPtx,
qreal  ctrlPty,
qreal  endPtx,
qreal  endPty 

◆ rotate()

void RPainterPath::rotate ( double  angle)

◆ rotateList()

void RPainterPath::rotateList ( QList< RPainterPath > &  pps,
double  angle 

◆ scale()

void RPainterPath::scale ( double  fx,
double  fy 

◆ scaleList()

void RPainterPath::scaleList ( QList< RPainterPath > &  pps,
double  fx,
double  fy 

◆ setAlwaysRegen()

void RPainterPath::setAlwaysRegen ( bool  on)

◆ setAutoRegen()

void RPainterPath::setAutoRegen ( bool  on)

◆ setBrush()

void RPainterPath::setBrush ( const QBrush &  b)

◆ setFeatureSize()

void RPainterPath::setFeatureSize ( double  s)

◆ setFixedBrushColor()

void RPainterPath::setFixedBrushColor ( bool  on)

◆ setFixedPenColor()

void RPainterPath::setFixedPenColor ( bool  on)

◆ setHighlighted()

void RPainterPath::setHighlighted ( bool  on)

◆ setInheritPen()

void RPainterPath::setInheritPen ( bool  on)

◆ setMode()

void RPainterPath::setMode ( RPainterPath::Mode  mode,
bool  on = true 

◆ setNoClipping()

void RPainterPath::setNoClipping ( bool  on)

◆ setNoColorMode()

void RPainterPath::setNoColorMode ( bool  on)

◆ setPath()

void RPainterPath::setPath ( const QPainterPath &  path)

◆ setPen()

void RPainterPath::setPen ( const QPen &  p)

Sets the pen of this painter path.

The pen may be set before painting the path but this is up to the caller.

◆ setPixelSizeHint()

void RPainterPath::setPixelSizeHint ( double  s)

◆ setPixelUnit()

void RPainterPath::setPixelUnit ( bool  on)

◆ setPixelWidth()

void RPainterPath::setPixelWidth ( bool  on)

◆ setPoints()

void RPainterPath::setPoints ( const QList< RVector > &  p)

◆ setSelected()

void RPainterPath::setSelected ( bool  on)

◆ setSimplePointDisplay()

void RPainterPath::setSimplePointDisplay ( bool  on)

◆ setValid()

void RPainterPath::setValid ( bool  on)

◆ setZLevel()

void RPainterPath::setZLevel ( int  zl)

Sets the z-level of the painter path.

Painter paths may be ordered by z-level when drawn.

◆ transform()

void RPainterPath::transform ( const QTransform &  t)

◆ translateList()

void RPainterPath::translateList ( QList< RPainterPath > &  pps,
const RVector offset 

Member Data Documentation

◆ brush

QBrush RPainterPath::brush

◆ featureSize

double RPainterPath::featureSize

◆ modes

Modes RPainterPath::modes

◆ originalShapes

QList<QSharedPointer<RShape> > RPainterPath::originalShapes

◆ pen

QPen RPainterPath::pen

◆ pixelSizeHint

double RPainterPath::pixelSizeHint

◆ points

QList<RVector> RPainterPath::points

◆ zLevel

int RPainterPath::zLevel

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