Qt 4.8
Public Functions | Properties | List of all members
QSvgPolyline Class Reference

#include <qsvggraphics_p.h>

Inheritance diagram for QSvgPolyline:
QSvgNode

Public Functions

virtual QRectF bounds (QPainter *p, QSvgExtraStates &states) const
 
virtual void draw (QPainter *p, QSvgExtraStates &states)
 
 QSvgPolyline (QSvgNode *parent, const QPolygonF &poly)
 
virtual Type type () const
 
- Public Functions inherited from QSvgNode
void appendStyleProperty (QSvgStyleProperty *prop, const QString &id)
 
void applyStyle (QPainter *p, QSvgExtraStates &states) const
 
DisplayMode displayMode () const
 
QSvgTinyDocumentdocument () const
 
bool isVisible () const
 
QString nodeId () const
 
QSvgNodeparent () const
 
 QSvgNode (QSvgNode *parent=0)
 
const QStringListrequiredExtensions () const
 
const QStringListrequiredFeatures () const
 
const QStringListrequiredFonts () const
 
const QStringListrequiredFormats () const
 
const QStringListrequiredLanguages () const
 
void revertStyle (QPainter *p, QSvgExtraStates &states) const
 
void setDisplayMode (DisplayMode display)
 
void setNodeId (const QString &i)
 
void setRequiredExtensions (const QStringList &lst)
 
void setRequiredFeatures (const QStringList &lst)
 
void setRequiredFonts (const QStringList &lst)
 
void setRequiredFormats (const QStringList &lst)
 
void setRequiredLanguages (const QStringList &lst)
 
void setVisible (bool visible)
 
void setXmlClass (const QString &str)
 
QSvgStylePropertystyleProperty (QSvgStyleProperty::Type type) const
 
QSvgFillStylePropertystyleProperty (const QString &id) const
 
virtual QRectF transformedBounds (QPainter *p, QSvgExtraStates &states) const
 
QRectF transformedBounds () const
 
QString xmlClass () const
 
virtual ~QSvgNode ()
 

Properties

QPolygonF m_poly
 

Additional Inherited Members

- Public Types inherited from QSvgNode
enum  DisplayMode {
  InlineMode, BlockMode, ListItemMode, RunInMode,
  CompactMode, MarkerMode, TableMode, InlineTableMode,
  TableRowGroupMode, TableHeaderGroupMode, TableFooterGroupMode, TableRowMode,
  TableColumnGroupMode, TableColumnMode, TableCellMode, TableCaptionMode,
  NoneMode, InheritMode
}
 
enum  Type {
  DOC, G, DEFS, SWITCH,
  ANIMATION, ARC, CIRCLE, ELLIPSE,
  IMAGE, LINE, PATH, POLYGON,
  POLYLINE, RECT, TEXT, TEXTAREA,
  TSPAN, USE, VIDEO
}
 
- Static Protected Functions inherited from QSvgNode
static qreal strokeWidth (QPainter *p)
 
- Protected Variables inherited from QSvgNode
QSvgStyle m_style
 

Detailed Description

Definition at line 156 of file qsvggraphics_p.h.

Constructors and Destructors

◆ QSvgPolyline()

QSvgPolyline::QSvgPolyline ( QSvgNode parent,
const QPolygonF poly 
)

Definition at line 209 of file qsvggraphics.cpp.

210  : QSvgNode(parent), m_poly(poly)
211 {
212 
213 }
QPolygonF m_poly
QSvgNode(QSvgNode *parent=0)
Definition: qsvgnode.cpp:52

Functions

◆ bounds()

QRectF QSvgPolyline::bounds ( QPainter p,
QSvgExtraStates states 
) const
virtual

Reimplemented from QSvgNode.

Definition at line 570 of file qsvggraphics.cpp.

571 {
572  qreal sw = strokeWidth(p);
573  if (qFuzzyIsNull(sw)) {
574  return p->transform().map(m_poly).boundingRect();
575  } else {
576  QPainterPath path;
577  path.addPolygon(m_poly);
578  return boundsOnStroke(p, path, sw);
579  }
580 }
double qreal
Definition: qglobal.h:1193
const QTransform & transform() const
Returns the world transformation matrix.
Definition: qpainter.cpp:9558
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
QPolygonF m_poly
void addPolygon(const QPolygonF &polygon)
Adds the given polygon to the path as an (unclosed) subpath.
QPoint map(const QPoint &p) const
Creates and returns a QPoint object that is a copy of the given point, mapped into the coordinate sys...
static qreal strokeWidth(QPainter *p)
Definition: qsvgnode.cpp:335
static QRectF boundsOnStroke(QPainter *p, const QPainterPath &path, qreal width)
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Definition: qglobal.h:2043

◆ draw()

void QSvgPolyline::draw ( QPainter p,
QSvgExtraStates states 
)
virtual

Implements QSvgNode.

Definition at line 215 of file qsvggraphics.cpp.

216 {
217  applyStyle(p, states);
218  qreal oldOpacity = p->opacity();
219  if (p->brush().style() != Qt::NoBrush) {
220  QPen save = p->pen();
221  p->setPen(QPen(Qt::NoPen));
222  p->setOpacity(oldOpacity * states.fillOpacity);
223  p->drawPolygon(m_poly, states.fillRule);
224  p->setPen(save);
225  }
226  if (p->pen().widthF() != 0) {
227  p->setOpacity(oldOpacity * states.strokeOpacity);
228  p->drawPolyline(m_poly);
229  }
230  p->setOpacity(oldOpacity);
231  revertStyle(p, states);
232 }
double qreal
Definition: qglobal.h:1193
qreal opacity() const
Returns the opacity of the painter.
Definition: qpainter.cpp:2115
QPolygonF m_poly
void applyStyle(QPainter *p, QSvgExtraStates &states) const
Definition: qsvgnode.cpp:118
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
const QPen & pen() const
Returns the painter&#39;s current pen.
Definition: qpainter.cpp:4152
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule=Qt::OddEvenFill)
Draws the polygon defined by the first pointCount points in the array points using the current pen an...
Definition: qpainter.cpp:5205
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
Qt::FillRule fillRule
Definition: qsvgstyle_p.h:150
const QBrush & brush() const
Returns the painter&#39;s current brush.
Definition: qpainter.cpp:4232
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
qreal widthF() const
Returns the pen width with floating point precision.
Definition: qpen.cpp:645
void setOpacity(qreal opacity)
Sets the opacity of the painter to opacity.
Definition: qpainter.cpp:2139
void revertStyle(QPainter *p, QSvgExtraStates &states) const
Definition: qsvgnode.cpp:123
void drawPolyline(const QPointF *points, int pointCount)
Draws the polyline defined by the first pointCount points in points using the current pen...
Definition: qpainter.cpp:5055

◆ type()

QSvgNode::Type QSvgPolyline::type ( ) const
virtual

Implements QSvgNode.

Definition at line 534 of file qsvggraphics.cpp.

535 {
536  return POLYLINE;
537 }

Properties

◆ m_poly

QPolygonF QSvgPolyline::m_poly
private

Definition at line 164 of file qsvggraphics_p.h.

Referenced by draw().


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