Qt 4.8
Classes | Functions
qpainterpath.h File Reference
#include <QtGui/qmatrix.h>
#include <QtCore/qglobal.h>
#include <QtCore/qrect.h>
#include <QtCore/qline.h>
#include <QtCore/qvector.h>
#include <QtCore/qscopedpointer.h>

Go to the source code of this file.

Classes

class  QPainterPath
 The QPainterPath class provides a container for painting operations, enabling graphical shapes to be constructed and reused. More...
 
class  QPainterPath::Element
 The QPainterPath::Element class specifies the position and type of a subpath. More...
 
class  QPainterPathPrivate
 
class  QPainterPathStroker
 The QPainterPathStroker class is used to generate fillable outlines for a given painter path. More...
 

Functions

Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &, const QPainterPath &)
 
Q_GUI_EXPORT QDebug operator<< (QDebug, const QPainterPath &)
 
Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &, QPainterPath &)
 
 Q_DECLARE_TYPEINFO (QPainterPath::Element, Q_PRIMITIVE_TYPE)
 

Function Documentation

◆ operator<<() [1/2]

Q_GUI_EXPORT QDataStream& operator<< ( QDataStream ,
const QPainterPath  
)

Definition at line 2509 of file qpainterpath.cpp.

Referenced by QPainterPath::detach().

2510 {
2511  if (p.isEmpty()) {
2512  s << 0;
2513  return s;
2514  }
2515 
2516  s << p.elementCount();
2517  for (int i=0; i < p.d_func()->elements.size(); ++i) {
2518  const QPainterPath::Element &e = p.d_func()->elements.at(i);
2519  s << int(e.type);
2520  s << double(e.x) << double(e.y);
2521  }
2522  s << p.d_func()->cStart;
2523  s << int(p.d_func()->fillRule);
2524  return s;
2525 }
ElementType type
the type of element
Definition: qpainterpath.h:81
The QPainterPath::Element class specifies the position and type of a subpath.
Definition: qpainterpath.h:77
qreal y
the y coordinate of the element&#39;s position.
Definition: qpainterpath.h:80
qreal x
the x coordinate of the element&#39;s position.
Definition: qpainterpath.h:79

◆ operator<<() [2/2]

Q_GUI_EXPORT QDebug operator<< ( QDebug  ,
const QPainterPath  
)

Definition at line 3618 of file qpainterpath.cpp.

3619 {
3620  s.nospace() << "QPainterPath: Element count=" << p.elementCount() << endl;
3621  const char *types[] = {"MoveTo", "LineTo", "CurveTo", "CurveToData"};
3622  for (int i=0; i<p.elementCount(); ++i) {
3623  s.nospace() << " -> " << types[p.elementAt(i).type] << "(x=" << p.elementAt(i).x << ", y=" << p.elementAt(i).y << ')' << endl;
3624 
3625  }
3626  return s;
3627 }
QTextStream & endl(QTextStream &stream)
Writes &#39; &#39; to the stream and flushes the stream.
static const struct @32 types[]

◆ operator>>()

Q_GUI_EXPORT QDataStream& operator>> ( QDataStream ,
QPainterPath  
)

Definition at line 2539 of file qpainterpath.cpp.

2540 {
2541  int size;
2542  s >> size;
2543 
2544  if (size == 0)
2545  return s;
2546 
2547  p.ensureData(); // in case if p.d_func() == 0
2548  if (p.d_func()->elements.size() == 1) {
2549  Q_ASSERT(p.d_func()->elements.at(0).type == QPainterPath::MoveToElement);
2550  p.d_func()->elements.clear();
2551  }
2552  p.d_func()->elements.reserve(p.d_func()->elements.size() + size);
2553  for (int i=0; i<size; ++i) {
2554  int type;
2555  double x, y;
2556  s >> type;
2557  s >> x;
2558  s >> y;
2559  Q_ASSERT(type >= 0 && type <= 3);
2560  if (!qt_is_finite(x) || !qt_is_finite(y)) {
2561 #ifndef QT_NO_DEBUG
2562  qWarning("QDataStream::operator>>: NaN or Inf element found in path, skipping it");
2563 #endif
2564  continue;
2565  }
2567  p.d_func()->elements.append(elm);
2568  }
2569  s >> p.d_func()->cStart;
2570  int fillRule;
2571  s >> fillRule;
2572  Q_ASSERT(fillRule == Qt::OddEvenFill || Qt::WindingFill);
2573  p.d_func()->fillRule = Qt::FillRule(fillRule);
2574  p.d_func()->dirtyBounds = true;
2575  p.d_func()->dirtyControlBounds = true;
2576  return s;
2577 }
The QPainterPath::Element class specifies the position and type of a subpath.
Definition: qpainterpath.h:77
ElementType
This enum describes the types of elements used to connect vertices in subpaths.
Definition: qpainterpath.h:70
int type
Definition: qmetatype.cpp:239
double qreal
Definition: qglobal.h:1193
FillRule
Definition: qnamespace.h:1485
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Q_CORE_EXPORT void qWarning(const char *,...)
static bool qt_is_finite(double d)
Definition: qnumeric_p.h:197

◆ Q_DECLARE_TYPEINFO()

Q_DECLARE_TYPEINFO ( QPainterPath::Element  ,
Q_PRIMITIVE_TYPE   
)