#include <qpen.h>
Collaboration diagram for QPen:

A pen has a style(), width(), brush(), capStyle() and joinStyle().
The pen style defines the line type. The brush is used to fill strokes generated with the pen. Use the QBrush class to specify fill styles. The cap style determines the line end caps that can be drawn using QPainter, while the join style describes how joins between two lines are drawn. The pen width can be specified in both integer (width()) and floating point (widthF()) precision. A line width of zero indicates a cosmetic pen. This means that the pen width is always drawn one pixel wide, independent of the {QPainter::Coordinate Transformations}{transformation} set on the painter.
The various settings can easily be modified using the corresponding setStyle(), setWidth(), setBrush(), setCapStyle() and setJoinStyle() functions (note that the painter's pen must be reset when altering the pen's properties).
For example:
QPainter painter(this); QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin); painter.setPen(pen);
which is equivalent to
QPainter painter(this); QPen pen(); // creates a default pen pen.setStyle(Qt::DashDotLine); pen.setWidth(3); pen.setBrush(Qt::green); pen.setCapStyle(Qt::RoundCap); pen.setJoinStyle(Qt::RoundJoin); painter.setPen(pen);
The default pen is a solid black brush with 0 width, square cap style (Qt::SquareCap), and bevel join style (Qt::BevelJoin).
In addition QPen provides the color() and setColor() convenience functions to extract and set the color of the pen's brush, respectively. Pens may also be compared and streamed.
For more information about painting in general, see {The Paint System} documentation.
Qt provides several built-in styles represented by the Qt::PenStyle enum: \table \row \o \inlineimage qpen-solid.png \o \inlineimage qpen-dash.png \o \inlineimage qpen-dot.png \row \o Qt::SolidLine \o Qt::DashLine \o Qt::DotLine \row \o \inlineimage qpen-dashdot.png \o \inlineimage qpen-dashdotdot.png \o \inlineimage qpen-custom.png \row \o Qt::DashDotLine \o Qt::DashDotDotLine \o Qt::CustomDashLine \endtable Simply use the setStyle() function to convert the pen style to either of the built-in styles, except the Qt::CustomDashLine style which we will come back to shortly. Setting the style to Qt::NoPen tells the painter to not draw lines or outlines. The default pen style is Qt::SolidLine. Since Qt 4.1 it is also possible to specify a custom dash pattern using the setDashPattern() function which implicitly converts the style of the pen to Qt::CustomDashLine. The pattern argument, a QVector, must be specified as an even number of \l qreal entries where the entries 1, 3, 5... are the dashes and 2, 4, 6... are the spaces. For example, the custom pattern shown above is created using the following code: @code QPen pen; QVector<qreal> dashes; qreal space = 4; dashes << 1 << space << 3 << space << 9 << space << 27 << space << 9; pen.setDashPattern(dashes); \endcode Note that the dash pattern is specified in units of the pens width, e.g. a dash of length 5 in width 10 is 50 pixels long. The currently set dash pattern can be retrieved using the dashPattern() function. Use the isSolid() function to determine whether the pen has a solid fill, or not. @section Cap Style The cap style defines how the end points of lines are drawn using QPainter. The cap style only apply to wide lines, i.e. when the width is 1 or greater. The Qt::PenCapStyle enum provides the following styles: \table \row \o \inlineimage qpen-square.png \o \inlineimage qpen-flat.png \o \inlineimage qpen-roundcap.png \row \o Qt::SquareCap \o Qt::FlatCap \o Qt::RoundCap \endtable The Qt::SquareCap style is a square line end that covers the end point and extends beyond it by half the line width. The Qt::FlatCap style is a square line end that does not cover the end point of the line. And the Qt::RoundCap style is a rounded line end covering the end point. The default is Qt::SquareCap. Whether or not end points are drawn when the pen width is 0 or 1 depends on the cap style. Using Qt::SquareCap or Qt::RoundCap they are drawn, using Qt::FlatCap they are not drawn. @section Join Style The join style defines how joins between two connected lines can be drawn using QPainter. The join style only apply to wide lines, i.e. when the width is 1 or greater. The Qt::PenJoinStyle enum provides the following styles: \table \row \o \inlineimage qpen-bevel.png \o \inlineimage qpen-miter.png \o \inlineimage qpen-roundjoin.png \row \o Qt::BevelJoin \o Qt::MiterJoin \o Qt::RoundJoin \endtable The Qt::BevelJoin style fills the triangular notch between the two lines. The Qt::MiterJoin style extends the lines to meet at an angle. And the Qt::RoundJoin style fills a circular arc between the two lines. The default is Qt::BevelJoin. \image qpen-miterlimit.png When the Qt::MiterJoin style is applied, it is possible to use the setMiterLimit() function to specify how far the miter join can extend from the join point. The miterLimit() is used to reduce artifacts between line joins where the lines are close to parallel. The miterLimit() must be specified in units of the pens width, e.g. a miter limit of 5 in width 10 is 50 pixels long. The default miter limit is 2, i.e. twice the pen width in pixels. \table 100% \row \o \inlineimage qpen-demo.png \o \bold {\l {demos/pathstroke}{The Path Stroking Demo}} The Path Stroking demo shows Qt's built-in dash patterns and shows how custom patterns can be used to extend the range of available patterns. \endtable \sa QPainter, QBrush, {demos/pathstroke}{Path Stroking Demo}, {Scribble Example} Definition at line 43 of file qpen.h.
Public Member Functions | |
| QPen () | |
| QPen (Qt::PenStyle) | |
| QPen (const QColor &color) | |
| QPen (const QBrush &brush, qreal width, Qt::PenStyle s=Qt::SolidLine, Qt::PenCapStyle c=Qt::SquareCap, Qt::PenJoinStyle j=Qt::BevelJoin) | |
| QPen (const QPen &pen) | |
| ~QPen () | |
| QPen & | operator= (const QPen &pen) |
| Qt::PenStyle | style () const |
| void | setStyle (Qt::PenStyle) |
| QVector< qreal > | dashPattern () const |
| void | setDashPattern (const QVector< qreal > &pattern) |
| qreal | miterLimit () const |
| void | setMiterLimit (qreal limit) |
| qreal | widthF () const |
| void | setWidthF (qreal width) |
| int | width () const |
| void | setWidth (int width) |
| QColor | color () const |
| void | setColor (const QColor &color) |
| QBrush | brush () const |
| void | setBrush (const QBrush &brush) |
| bool | isSolid () const |
| Qt::PenCapStyle | capStyle () const |
| void | setCapStyle (Qt::PenCapStyle pcs) |
| Qt::PenJoinStyle | joinStyle () const |
| void | setJoinStyle (Qt::PenJoinStyle pcs) |
| bool | operator== (const QPen &p) const |
| bool | operator!= (const QPen &p) const |
| operator QVariant () const | |
| bool | isDetached () |
Private Member Functions | |
| void | detach () |
Private Attributes | |
| QPenPrivate * | d |
Friends | |
| class | QPainter |
| Q_GUI_EXPORT QDataStream & | operator>> (QDataStream &, QPen &) |
| Q_GUI_EXPORT QDataStream & | operator<< (QDataStream &, const QPen &) |
| QPen::QPen | ( | ) |
Constructs a default black solid line pen with 0 width.
Definition at line 307 of file qpen.cpp.
References d, defaultPenInstance(), QBasicAtomic::ref(), and QPenPrivate::ref.
00308 { 00309 d = defaultPenInstance(); 00310 d->ref.ref(); 00311 }
Here is the call graph for this function:

| QPen::QPen | ( | Qt::PenStyle | style | ) |
Constructs a black pen with 0 width and the given style.
Definition at line 319 of file qpen.cpp.
References Qt::black, d, Qt::NoPen, nullPenInstance(), qpen_default_cap, qpen_default_join, QBasicAtomic::ref(), and QPenPrivate::ref.
00320 { 00321 if (style == Qt::NoPen) { 00322 d = nullPenInstance(); 00323 d->ref.ref(); 00324 } else { 00325 d = new QPenPrivate(Qt::black, 0, style, qpen_default_cap, qpen_default_join); 00326 } 00327 }
Here is the call graph for this function:

| QPen::QPen | ( | const QColor & | color | ) |
Constructs a pen with 0 width and the given color.
Definition at line 336 of file qpen.cpp.
References color(), d, qpen_default_cap, qpen_default_join, and Qt::SolidLine.
00337 { 00338 d = new QPenPrivate(color, 0, Qt::SolidLine, qpen_default_cap, qpen_default_join); 00339 }
Here is the call graph for this function:

| QPen::QPen | ( | const QBrush & | brush, | |
| qreal | width, | |||
| Qt::PenStyle | style = Qt::SolidLine, |
|||
| Qt::PenCapStyle | cap = Qt::SquareCap, |
|||
| Qt::PenJoinStyle | join = Qt::BevelJoin | |||
| ) |
Constructs a pen with the specified brush, width, pen style, cap style and join style.
Definition at line 351 of file qpen.cpp.
Here is the call graph for this function:

| QPen::QPen | ( | const QPen & | pen | ) |
| QPen::~QPen | ( | ) |
Destroys the pen.
Definition at line 373 of file qpen.cpp.
References d, QBasicAtomic::deref(), and QPenPrivate::ref.
Here is the call graph for this function:

Assigns the given pen to this pen and returns a reference to this pen.
Definition at line 411 of file qpen.cpp.
References d, p, and qAtomicAssign().
00412 { 00413 qAtomicAssign(d, p.d); 00414 return *this; 00415 }
Here is the call graph for this function:

| Qt::PenStyle QPen::style | ( | ) | const |
Returns the pen style.
Definition at line 433 of file qpen.cpp.
References d, and QPenPrivate::style.
Referenced by Q3SVGPaintEnginePrivate::applyStyle(), QPainterPrivate::draw_helper(), QPainterPrivate::drawOpaqueBackground(), QPainterPrivate::drawStretchToDevice(), QPainter::drawText(), QPainter::fillRect(), is_pen_transparent(), HoverPoints::paintPoints(), parseDefaultTextStyle(), Q3SVGPaintEnginePrivate::play(), QPainterPrivate::rectSubtraction(), QPainter::setPen(), QPdf::Stroker::setPen(), Q3SVGPaintEnginePrivate::setStyleProperty(), QPicturePaintEngine::updatePen(), and QX11PaintEngine::updatePen().
| void QPen::setStyle | ( | Qt::PenStyle | style | ) |
Sets the pen style to the given style.
See the Qt::PenStyle documentation for a list of the available styles. Since Qt 4.1 it is also possible to specify a custom dash pattern using the setDashPattern() function which implicitly converts the style of the pen to Qt::CustomDashLine.
Definition at line 451 of file qpen.cpp.
References QVector< T >::clear(), d, QPenPrivate::dashPattern, detach(), and QPenPrivate::style.
Referenced by PrintOut::drawRule(), drawTextItemDecoration(), parsePen(), parseQPen(), QGraphicsSimpleTextItemPrivate::QGraphicsSimpleTextItemPrivate(), and Q3SVGPaintEnginePrivate::setStyleProperty().
00452 { 00453 if (d->style == s) 00454 return; 00455 detach(); 00456 d->style = s; 00457 d->dashPattern.clear(); 00458 }
Here is the call graph for this function:

| QVector< qreal > QPen::dashPattern | ( | ) | const |
Returns the dash pattern of this pen.
Definition at line 465 of file qpen.cpp.
References d, Qt::DashDotDotLine, Qt::DashDotLine, Qt::DashLine, QPenPrivate::dashPattern, Qt::DotLine, QVector< T >::isEmpty(), Qt::NoPen, Qt::SolidLine, and QPenPrivate::style.
Referenced by drawLine_midpoint_dashed_i(), QPdf::generateDashes(), operator==(), and QPdf::Stroker::setPen().
00466 { 00467 if (d->style == Qt::SolidLine || d->style == Qt::NoPen) { 00468 return QVector<qreal>(); 00469 } else if (d->dashPattern.isEmpty()) { 00470 const qreal space = 2; 00471 const qreal dot = 1; 00472 const qreal dash = 4; 00473 00474 switch (d->style) { 00475 case Qt::DashLine: 00476 d->dashPattern << dash << space; 00477 break; 00478 case Qt::DotLine: 00479 d->dashPattern << dot << space; 00480 break; 00481 case Qt::DashDotLine: 00482 d->dashPattern << dash << space << dot << space; 00483 break; 00484 case Qt::DashDotDotLine: 00485 d->dashPattern << dash << space << dot << space << dot << space; 00486 break; 00487 default: 00488 break; 00489 } 00490 } 00491 return d->dashPattern; 00492 }
Here is the call graph for this function:

| void QPen::setDashPattern | ( | const QVector< qreal > & | pattern | ) |
Sets the dash pattern for this pen to the given pattern. This implicitly converts the style of the pen to Qt::CustomDashLine.
The pattern must be specified as an even number of entries where the entries 1, 3, 5... are the dashes and 2, 4, 6... are the spaces. For example:
100% qpen-custom.png
QPen pen; QVector<qreal> dashes; qreal space = 4; dashes << 1 << space << 3 << space << 9 << space << 27 << space << 9; pen.setDashPattern(dashes);
The dash pattern is specified in units of the pens width, e.g. a dash of length 5 in width 10 is 50 pixels long. Each dash is also subject to cap styles so a dash of 1 with square cap set will extend 0.5 pixels out in each direction resulting in a total width of 2.
Note that the default cap style is Qt::SquareCap, meaning that a square line end covers the end point and extends beyond it by half the line width.
Definition at line 528 of file qpen.cpp.
References Qt::CustomDashLine, d, QPenPrivate::dashPattern, detach(), QVector< T >::isEmpty(), qWarning(), QVector< T >::size(), and QPenPrivate::style.
Referenced by parseQPen().
00529 { 00530 if (pattern.isEmpty()) 00531 return; 00532 detach(); 00533 d->dashPattern = pattern; 00534 d->style = Qt::CustomDashLine; 00535 00536 if ((d->dashPattern.size() % 2) == 1) { 00537 qWarning("QPen::setDashPattern: Pattern not of even length"); 00538 d->dashPattern << 1; 00539 } 00540 }
Here is the call graph for this function:

| qreal QPen::miterLimit | ( | ) | const |
Returns the miter limit of the pen. The miter limit is only relevant when the join style is set to Qt::MiterJoin.
Definition at line 548 of file qpen.cpp.
References d, and QPenPrivate::miterLimit.
Referenced by QPainterPrivate::drawStretchToDevice(), qt_graphicsItem_shapeFromPath(), and QPdf::Stroker::setPen().
00549 { 00550 return d->miterLimit; 00551 }
| void QPen::setMiterLimit | ( | qreal | limit | ) |
Sets the miter limit of this pen to the given limit.
The miter limit describes how far a miter join can extend from the join point. This is used to reduce artifacts between line joins where the lines are close to parallel.
This value does only have effect when the pen style is set to Qt::MiterJoin. The value is specified in units of the pen's width, e.g. a miter limit of 5 in width 10 is 50 pixels long. The default miter limit is 2, i.e. twice the pen width in pixels.
Definition at line 569 of file qpen.cpp.
References d, detach(), and QPenPrivate::miterLimit.
Referenced by parseQPen(), and QSvgHandler::QSvgHandler().
00570 { 00571 detach(); 00572 d->miterLimit = limit; 00573 }
Here is the call graph for this function:

| qreal QPen::widthF | ( | ) | const |
Returns the pen width with floating point precision.
Definition at line 596 of file qpen.cpp.
References d, and QPenPrivate::width.
Referenced by QX11PaintEnginePrivate::decidePathFallback(), QPainterPrivate::draw_helper(), QPainterPrivate::drawStretchToDevice(), QPdf::generateDashes(), parseQPen(), qt_graphicsItem_shapeFromPath(), QPainter::setPen(), QAbstractGraphicsShapeItem::setPen(), QPdf::Stroker::setPen(), and QX11PaintEngine::updatePen().
| void QPen::setWidthF | ( | qreal | width | ) |
Sets the pen width to the given width in pixels with floating point precision.
A line width of zero indicates a cosmetic pen. This means that the pen width is always drawn one pixel wide, independent of the {QPainter::Coordinate Transformations}{transformation} on the painter.
Setting a pen width with a negative value is not supported.
Definition at line 640 of file qpen.cpp.
References d, detach(), qWarning(), and QPenPrivate::width.
Referenced by QSvgFont::draw(), QX11PaintEngine::drawBox(), drawTextItemDecoration(), qdesigner_internal::QtGradientWidget::paintEvent(), qdesigner_internal::QtGradientStopsWidget::paintEvent(), and parseQPen().
00641 { 00642 if (width < 0.f) 00643 qWarning("QPen::setWidthF: Setting a pen width with a negative value is not defined"); 00644 if (qAbs(d->width - width) < 0.00000001f) 00645 return; 00646 detach(); 00647 d->width = width; 00648 }
Here is the call graph for this function:

| int QPen::width | ( | ) | const |
Returns the pen width with integer precision.
Definition at line 584 of file qpen.cpp.
References d, qRound(), and QPenPrivate::width.
Referenced by Q3SVGPaintEnginePrivate::applyStyle(), Q3CanvasRectangle::areaPoints(), Q3CanvasLine::areaPoints(), QPainterPrivate::drawOpaqueBackground(), BasicToolsPlugin::mouseMove(), QPainterPrivate::rectSubtraction(), Q3SVGPaintEnginePrivate::setStyleProperty(), QPicturePaintEngine::updatePen(), and QPicturePaintEngine::writeCmdLength().
Here is the call graph for this function:

| void QPen::setWidth | ( | int | width | ) |
Sets the pen width to the given width in pixels with integer precision.
A line width of zero indicates a cosmetic pen. This means that the pen width is always drawn one pixel wide, independent of the {QPainter::Coordinate Transformations}{transformation} set on the painter.
Setting a pen width with a negative value is not supported.
Definition at line 616 of file qpen.cpp.
References d, detach(), qWarning(), and QPenPrivate::width.
Referenced by PrintOut::drawRule(), Helper::Helper(), Chip::paint(), and Q3SVGPaintEnginePrivate::setStyleProperty().
00617 { 00618 if (width < 0) 00619 qWarning("QPen::setWidth: Setting a pen width with a negative value is not defined"); 00620 if ((qreal)width == d->width) 00621 return; 00622 detach(); 00623 d->width = width; 00624 }
Here is the call graph for this function:

| QColor QPen::color | ( | ) | const |
Returns the color of this pen's brush.
Definition at line 712 of file qpen.cpp.
References QPenPrivate::brush, QBrush::color(), and d.
Referenced by PanelShape::animate(), TitleShape::animate(), Q3SVGPaintEnginePrivate::applyStyle(), drawTextItemDecoration(), BasicToolsPlugin::mouseMove(), Q3SVGPaintEnginePrivate::play(), QPen(), qt_render_bitmap(), QPainter::setPen(), Q3SVGPaintEnginePrivate::setStyleProperty(), QPicturePaintEngine::updatePen(), and QX11PaintEngine::updatePen().
Here is the call graph for this function:

| void QPen::setColor | ( | const QColor & | color | ) |
Sets the color of this pen's brush to the given color.
Definition at line 725 of file qpen.cpp.
References QPenPrivate::brush, c, d, and detach().
Referenced by PanelShape::animate(), TitleShape::animate(), QSvgAnimateColor::apply(), QSvgSolidColorStyle::apply(), PrintOut::drawRule(), drawTextItemDecoration(), parseQPen(), Q3SVGPaintEnginePrivate::play(), and Q3SVGPaintEnginePrivate::setStyleProperty().
Here is the call graph for this function:

| QBrush QPen::brush | ( | ) | const |
Returns the brush used to fill strokes generated with this pen.
Definition at line 735 of file qpen.cpp.
References QPenPrivate::brush, and d.
Referenced by QPainterPrivate::drawStretchToDevice(), QPaintEngine::drawTextItem(), QX11PaintEnginePrivate::fillPolygon_dev(), is_pen_transparent(), QPen(), setBrush(), and QPainter::setPen().
| void QPen::setBrush | ( | const QBrush & | brush | ) |
Sets the brush used to fill strokes generated with this pen to the given brush.
Definition at line 747 of file qpen.cpp.
References QPenPrivate::brush, brush(), d, and detach().
Referenced by qdesigner_internal::QtGradientStopsWidget::paintEvent(), and parseQPen().
Here is the call graph for this function:

| bool QPen::isSolid | ( | ) | const |
Returns true if the pen has a solid fill, otherwise false.
Definition at line 759 of file qpen.cpp.
References QPenPrivate::brush, d, Qt::SolidPattern, and QBrush::style().
Referenced by QPainter::setPen().
00760 { 00761 return d->brush.style() == Qt::SolidPattern; 00762 }
Here is the call graph for this function:

| Qt::PenCapStyle QPen::capStyle | ( | ) | const |
Returns the pen's cap style.
Definition at line 656 of file qpen.cpp.
References QPenPrivate::capStyle, and d.
Referenced by QPainterPrivate::draw_helper(), QPainter::drawPoints(), QPainterPrivate::drawStretchToDevice(), qt_graphicsItem_shapeFromPath(), QPainter::setPen(), QPdf::Stroker::setPen(), and QX11PaintEngine::updatePen().
| void QPen::setCapStyle | ( | Qt::PenCapStyle | style | ) |
Sets the pen's cap style to the given style. The default value is Qt::SquareCap.
Definition at line 670 of file qpen.cpp.
References QPenPrivate::capStyle, d, and detach().
Referenced by QPainter::drawPoints(), parseQPen(), qDrawRoundedCorners(), and Q3SVGPaintEnginePrivate::setStyleProperty().
Here is the call graph for this function:

| Qt::PenJoinStyle QPen::joinStyle | ( | ) | const |
Returns the pen's join style.
Definition at line 683 of file qpen.cpp.
References d, and QPenPrivate::joinStyle.
Referenced by QPainterPrivate::draw_helper(), QPainterPrivate::drawStretchToDevice(), qt_graphicsItem_shapeFromPath(), QPainter::setPen(), QPdf::Stroker::setPen(), and QX11PaintEngine::updatePen().
| void QPen::setJoinStyle | ( | Qt::PenJoinStyle | style | ) |
Sets the pen's join style to the given style. The default value is Qt::BevelJoin.
Definition at line 697 of file qpen.cpp.
References d, detach(), and QPenPrivate::joinStyle.
Referenced by parseQPen(), and Q3SVGPaintEnginePrivate::setStyleProperty().
Here is the call graph for this function:

| bool QPen::operator== | ( | const QPen & | pen | ) | const |
Returns true if the pen is equal to the given pen; otherwise false. Two pens are equal if they have equal styles, widths and colors.
Definition at line 785 of file qpen.cpp.
References QPenPrivate::brush, QPenPrivate::capStyle, Qt::CustomDashLine, d, dashPattern(), QPenPrivate::joinStyle, QPenPrivate::miterLimit, p, QPenPrivate::style, and QPenPrivate::width.
00786 { 00787 return (p.d == d) || (p.d->style == d->style 00788 && p.d->capStyle == d->capStyle 00789 && p.d->joinStyle == d->joinStyle 00790 && p.d->width == d->width 00791 && p.d->miterLimit == d->miterLimit 00792 && (d->style != Qt::CustomDashLine 00793 || p.dashPattern() == dashPattern()) 00794 && p.d->brush == d->brush); 00795 }
Here is the call graph for this function:

| bool QPen::operator!= | ( | const QPen & | pen | ) | const [inline] |
Returns true if the pen is different from the given pen; otherwise false. Two pens are different if they have different styles, widths or colors.
Definition at line 87 of file qpen.h.
References operator==(), and p.
00087 { return !(operator==(p)); }
Here is the call graph for this function:

| QPen::operator QVariant | ( | ) | const |
Returns the pen as a QVariant.
Definition at line 420 of file qpen.cpp.
References QVariant::Pen.
00421 { 00422 return QVariant(QVariant::Pen, this); 00423 }
| bool QPen::isDetached | ( | ) |
| void QPen::detach | ( | ) | [private] |
Detaches from shared pen data to make sure that this pen is the only one referring the data.
If multiple pens share common data, this pen dereferences the data and gets a copy of the data. Nothing is done if there is just a single reference.
Definition at line 389 of file qpen.cpp.
References QPenPrivate::brush, QPenPrivate::capStyle, d, QPenPrivate::dashPattern, QPenPrivate::joinStyle, QPenPrivate::miterLimit, qAtomicSetPtr(), QPenPrivate::ref, QPenPrivate::style, QPenPrivate::width, and x.
Referenced by setBrush(), setCapStyle(), setColor(), setDashPattern(), setJoinStyle(), setMiterLimit(), setStyle(), setWidth(), and setWidthF().
00390 { 00391 if (d->ref == 1) 00392 return; 00393 00394 QPenPrivate *x = new QPenPrivate(d->brush, d->width, d->style, d->capStyle, 00395 d->joinStyle); 00396 x->miterLimit = d->miterLimit; 00397 x->dashPattern = d->dashPattern; 00398 x = qAtomicSetPtr(&d, x); 00399 if (!x->ref.deref()) 00400 delete x; 00401 }
Here is the call graph for this function:

| QDataStream & operator>> | ( | QDataStream & | stream, | |
| QPen & | pen | |||
| ) | [friend] |
Reads a pen from the given stream into the given pen and returns a reference to the stream.
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 }
| QDataStream & operator<< | ( | QDataStream & | stream, | |
| const QPen & | pen | |||
| ) | [friend] |
Writes the given pen to the given stream and returns a reference to the stream.
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 }
class QPenPrivate* QPen::d [private] |
Definition at line 97 of file qpen.h.
Referenced by brush(), capStyle(), color(), dashPattern(), detach(), isDetached(), isSolid(), joinStyle(), miterLimit(), operator=(), operator==(), QPen(), setBrush(), setCapStyle(), setColor(), setDashPattern(), setJoinStyle(), setMiterLimit(), setStyle(), setWidth(), setWidthF(), style(), width(), widthF(), and ~QPen().
1.5.1