src/gui/painting/qpen.cpp File Reference

#include "qpen.h"
#include "qdatastream.h"
#include "qvariant.h"
#include "qbrush.h"
#include <qdebug.h>

Include dependency graph for qpen.cpp:

Go to the source code of this file.

Classes

class  QPenPrivate
class  QPenStatic

Functions

static QPenPrivatedefaultPenInstance ()
static QPenPrivatenullPenInstance ()
QDataStreamoperator<< (QDataStream &s, const QPen &p)
QDataStreamoperator>> (QDataStream &s, QPen &p)
QDebug operator<< (QDebug dbg, const QPen &p)

Variables

static const Qt::PenCapStyle qpen_default_cap = Qt::SquareCap
static const Qt::PenJoinStyle qpen_default_join = Qt::BevelJoin


Function Documentation

static QPenPrivate* defaultPenInstance (  )  [static]

Definition at line 280 of file qpen.cpp.

References Qt::black, defaultPen, q_atomic_test_and_set_ptr(), qpen_default_cap, qpen_default_join, Qt::SolidLine, and x.

Referenced by QPen::QPen().

00281 {
00282     static QPenStatic defaultPen;
00283     if (!defaultPen.pointer && !defaultPen.destroyed) {
00284         QPenPrivate *x = new QPenPrivate(Qt::black, 0, Qt::SolidLine,
00285                                          qpen_default_cap, qpen_default_join);
00286         if (!q_atomic_test_and_set_ptr(&defaultPen.pointer, 0, x))
00287             delete x;
00288     }
00289     return defaultPen.pointer;
00290 }

Here is the call graph for this function:

static QPenPrivate* nullPenInstance (  )  [static]

Definition at line 292 of file qpen.cpp.

References Qt::black, defaultPen, Qt::NoPen, q_atomic_test_and_set_ptr(), qpen_default_cap, qpen_default_join, and x.

Referenced by QPen::QPen().

00293 {
00294     static QPenStatic defaultPen;
00295     if (!defaultPen.pointer && !defaultPen.destroyed) {
00296         QPenPrivate *x = new QPenPrivate(Qt::black, 0, Qt::NoPen, qpen_default_cap, qpen_default_join);
00297         if (!q_atomic_test_and_set_ptr(&defaultPen.pointer, 0, x))
00298             delete x;
00299     }
00300     return defaultPen.pointer;
00301 }

Here is the call graph for this function:

QDebug operator<< ( QDebug  dbg,
const QPen p 
)

Definition at line 889 of file qpen.cpp.

00890 {
00891 #ifndef Q_BROKEN_DEBUG_STREAM
00892     dbg.nospace() << "QPen(" << p.width() << ',' << p.brush()
00893                   << ',' << int(p.style()) << ',' << int(p.capStyle())
00894                   << ',' << int(p.joinStyle()) << ',' << p.dashPattern()
00895                   << ',' << p.miterLimit() << ')';
00896     return dbg.space();
00897 #else
00898     qWarning("This compiler doesn't support streaming QPen to QDebug");
00899     return dbg;
00900     Q_UNUSED(p);
00901 #endif
00902 }

QDataStream& operator<< ( QDataStream s,
const QPen p 
)

Definition at line 824 of file qpen.cpp.

00825 {
00826     if (s.version() < 3)
00827         s << (quint8)p.style();
00828     else
00829         s << (quint8)(p.style() | p.capStyle() | p.joinStyle());
00830 
00831     if (s.version() < 7) {
00832         s << (quint8)p.width();
00833         s << p.color();
00834     } else {
00835         s << double(p.widthF());
00836         s << p.brush();
00837         s << double(p.miterLimit());
00838         s << p.dashPattern();
00839     }
00840     return s;
00841 }

QDataStream& operator>> ( QDataStream s,
QPen p 
)

Definition at line 853 of file qpen.cpp.

00854 {
00855     quint8 style;
00856     quint8 width8 = 0;
00857     double width = 0;
00858     QColor color;
00859     QBrush brush;
00860     double miterLimit = 2;
00861     QVector<qreal> dashPattern;
00862     s >> style;
00863     if (s.version() < 7) {
00864         s >> width8;
00865         s >> color;
00866         brush = color;
00867         width = width8;
00868     } else {
00869         s >> width;
00870         s >> brush;
00871         s >> miterLimit;
00872         s >> dashPattern;
00873     }
00874 
00875     p.detach();
00876     p.d->width = width;
00877     p.d->brush = brush;
00878     p.d->style = Qt::PenStyle(style & Qt::MPenStyle);
00879     p.d->capStyle = Qt::PenCapStyle(style & Qt::MPenCapStyle);
00880     p.d->joinStyle = Qt::PenJoinStyle(style & Qt::MPenJoinStyle);
00881     p.d->dashPattern = dashPattern;
00882     p.d->miterLimit = miterLimit;
00883 
00884     return s;
00885 }


Variable Documentation

const Qt::PenCapStyle qpen_default_cap = Qt::SquareCap [static]

Definition at line 256 of file qpen.cpp.

Referenced by defaultPenInstance(), nullPenInstance(), and QPen::QPen().

const Qt::PenJoinStyle qpen_default_join = Qt::BevelJoin [static]

Definition at line 257 of file qpen.cpp.

Referenced by defaultPenInstance(), nullPenInstance(), and QPen::QPen().


Generated on Thu Mar 15 13:35:51 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1