Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QPen Class Reference

\inmodule QtGui More...

#include <qpen.h>

+ Collaboration diagram for QPen:

Public Types

using DataPtr = QExplicitlySharedDataPointer<QPenPrivate>
 

Public Member Functions

 QPen ()
 Constructs a default black solid line pen with 1 width.
 
 QPen (Qt::PenStyle)
 Constructs a black pen with 1 width and the given style.
 
 QPen (const QColor &color)
 Constructs a solid line pen with 1 width and the given color.
 
 QPen (const QBrush &brush, qreal width, Qt::PenStyle s=Qt::SolidLine, Qt::PenCapStyle c=Qt::SquareCap, Qt::PenJoinStyle j=Qt::BevelJoin)
 Constructs a pen with the specified brush, width, pen style, cap style and join style.
 
 QPen (const QPen &pen) noexcept
 Constructs a pen that is a copy of the given pen.
 
 ~QPen ()
 Destroys the pen.
 
QPenoperator= (const QPen &pen) noexcept
 Assigns the given pen to this pen and returns a reference to this pen.
 
 QPen (QPen &&other) noexcept=default
 
void swap (QPen &other) noexcept
 
Qt::PenStyle style () const
 Returns the pen style.
 
void setStyle (Qt::PenStyle)
 [0]
 
QList< qrealdashPattern () const
 Returns the dash pattern of this pen.
 
void setDashPattern (const QList< qreal > &pattern)
 Sets the dash pattern for this pen to the given pattern.
 
qreal dashOffset () const
 Returns the dash offset for the pen.
 
void setDashOffset (qreal doffset)
 Sets the dash offset (the starting point on the dash pattern) for this pen to the offset specified.
 
qreal miterLimit () const
 Returns the miter limit of the pen.
 
void setMiterLimit (qreal limit)
 Sets the miter limit of this pen to the given limit.
 
qreal widthF () const
 Returns the pen width with floating point precision.
 
void setWidthF (qreal width)
 Sets the pen width to the given width in pixels with floating point precision.
 
int width () const
 Returns the pen width with integer precision.
 
void setWidth (int width)
 Sets the pen width to the given width in pixels with integer precision.
 
QColor color () const
 Returns the color of this pen's brush.
 
void setColor (const QColor &color)
 Sets the color of this pen's brush to the given color.
 
QBrush brush () const
 Returns the brush used to fill strokes generated with this pen.
 
void setBrush (const QBrush &brush)
 Sets the brush used to fill strokes generated with this pen to the given brush.
 
bool isSolid () const
 Returns true if the pen has a solid fill, otherwise false.
 
Qt::PenCapStyle capStyle () const
 Returns the pen's cap style.
 
void setCapStyle (Qt::PenCapStyle pcs)
 Sets the pen's cap style to the given style.
 
Qt::PenJoinStyle joinStyle () const
 Returns the pen's join style.
 
void setJoinStyle (Qt::PenJoinStyle pcs)
 Sets the pen's join style to the given style.
 
bool isCosmetic () const
 Returns true if the pen is cosmetic; otherwise returns false.
 
void setCosmetic (bool cosmetic)
 Sets this pen to cosmetic or non-cosmetic, depending on the value of cosmetic.
 
bool operator== (const QPen &p) const
 Returns true if the pen is equal to the given pen; otherwise false.
 
bool operator!= (const QPen &p) const
 Returns true if the pen is different from the given pen; otherwise false.
 
 operator QVariant () const
 Returns the pen as a QVariant.
 
bool isDetached ()
 
DataPtrdata_ptr ()
 

Friends

Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &, QPen &)
 Reads a pen from the given stream into the given pen and returns a reference to the stream.
 
Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &, const QPen &)
 Writes the given pen to the given stream and returns a reference to the stream.
 

Related Symbols

(Note that these are not member symbols.)

QDataStreamoperator<< (QDataStream &stream, const QPen &pen)
 Writes the given pen to the given stream and returns a reference to the stream.
 
QDataStreamoperator>> (QDataStream &stream, QPen &pen)
 Reads a pen from the given stream into the given pen and returns a reference to the stream.
 

Detailed Description

\inmodule QtGui

The QPen class defines how a QPainter should draw lines and outlines of shapes.

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 \l {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:

which is equivalent to

QPen pen; // creates a default pen
pen.setWidth(3);

The default pen is a solid black brush with 1 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 \l{Paint System} documentation.

Definition at line 27 of file qpen.h.

Member Typedef Documentation

◆ DataPtr

Constructor & Destructor Documentation

◆ QPen() [1/6]

qpen_default_join QPen::QPen ( )

Constructs a default black solid line pen with 1 width.

Definition at line 228 of file qpen.cpp.

References d.

◆ QPen() [2/6]

QPen::QPen ( Qt::PenStyle style)

Constructs a black pen with 1 width and the given style.

See also
setStyle()

Definition at line 239 of file qpen.cpp.

References Qt::black, Qt::NoPen, nullPenInstance, qpen_default_cap, qpen_default_join, and style().

+ Here is the call graph for this function:

◆ QPen() [3/6]

QPen::QPen ( const QColor & color)

Constructs a solid line pen with 1 width and the given color.

See also
setBrush(), setColor()

Definition at line 255 of file qpen.cpp.

References qpen_default_cap, qpen_default_join, and Qt::SolidLine.

◆ QPen() [4/6]

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.

See also
setBrush(), setWidth(), setStyle(), setCapStyle(), setJoinStyle()

Definition at line 270 of file qpen.cpp.

References j.

◆ QPen() [5/6]

QPen::QPen ( const QPen & pen)
noexcept

Constructs a pen that is a copy of the given pen.

Definition at line 281 of file qpen.cpp.

◆ ~QPen()

QPen::~QPen ( )
default

Destroys the pen.

◆ QPen() [6/6]

QPen::QPen ( QPen && pen)
defaultnoexcept
Since
5.4

Constructs a pen that is moved from the given pen.

The moved-from pen can only be assigned to, copied, or destroyed. Any other operation (prior to assignment) leads to undefined behavior.

Member Function Documentation

◆ brush()

◆ capStyle()

◆ color()

QColor QPen::color ( ) const

Returns the color of this pen's brush.

See also
brush(), setColor()

Definition at line 692 of file qpen.cpp.

References QPenPrivate::brush, and QBrush::color().

Referenced by QPdfEnginePrivate::addBrushPattern(), QTextDocumentLayoutPrivate::drawListItem(), QPainter::drawStaticText(), generateWavyPixmap(), hash(), QPainter::setPen(), QCoreGraphicsPaintEnginePrivate::setStrokePen(), QPaintEngineEx::stroke(), QPicturePaintEngine::updatePen(), QX11PaintEngine::updatePen(), and QPdfEngine::updateState().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dashOffset()

qreal QPen::dashOffset ( ) const

Returns the dash offset for the pen.

See also
setDashOffset()

Definition at line 484 of file qpen.cpp.

References QPenPrivate::dashOffset.

Referenced by QPainterPathStroker::QPainterPathStroker(), QCosmeticStroker::drawLine(), QCosmeticStroker::drawPath(), QPdf::generateDashes(), QDashedStrokeProcessor::process(), QPdf::Stroker::setPen(), QCoreGraphicsPaintEnginePrivate::setStrokePen(), QPaintEngineEx::stroke(), QWin32PrintEnginePrivate::strokePath(), and QRasterPaintEngine::updatePen().

+ Here is the caller graph for this function:

◆ dashPattern()

QList< qreal > QPen::dashPattern ( ) const

Returns the dash pattern of this pen.

See also
style(), isSolid()

Definition at line 400 of file qpen.cpp.

References Qt::DashDotDotLine, Qt::DashDotLine, Qt::DashLine, QPenPrivate::dashPattern, dot(), Qt::DotLine, QList< T >::isEmpty(), Qt::NoPen, QList< T >::reserve(), Qt::SolidLine, and QPenPrivate::style.

Referenced by QPainterPathStroker::QPainterPathStroker(), QSvgStrokeStyle::apply(), QPdf::generateDashes(), QDashedStrokeProcessor::process(), QRasterPaintEnginePrivate::rasterizeLine_dashed(), setDashOffset(), QPdf::Stroker::setPen(), QCoreGraphicsPaintEnginePrivate::setStrokePen(), QPaintEngineEx::stroke(), QWin32PrintEnginePrivate::strokePath(), and QRasterPaintEngine::updatePen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ data_ptr()

DataPtr & QPen::data_ptr ( )
inline

Definition at line 97 of file qpen.h.

References d.

◆ isCosmetic()

bool QPen::isCosmetic ( ) const

Returns true if the pen is cosmetic; otherwise returns false.

Cosmetic pens are used to draw strokes that have a constant width regardless of any transformations applied to the QPainter they are used with. Drawing a shape with a cosmetic pen ensures that its outline will have the same thickness at different scale factors.

A zero width pen is cosmetic by default.

See also
setCosmetic(), widthF()

Definition at line 757 of file qpen.cpp.

References QPenPrivate::cosmetic, and QPenPrivate::width.

Referenced by QAlphaPaintEnginePrivate::addPenWidth(), QSvgPaintEngine::drawEllipse(), QSvgPaintEngine::drawPath(), QSvgPaintEngine::drawPolygon(), QSvgPaintEngine::drawRects(), QTriangulatingStroker::process(), QDashedStrokeProcessor::process(), QPdf::Stroker::setPen(), QPaintEngineEx::stroke(), QOpenGL2PaintEngineExPrivate::stroke(), QOpenGL2PaintEngineEx::stroke(), QWin32PrintEnginePrivate::strokePath(), QSvgNode::strokeWidth(), and QRasterPaintEngine::updatePen().

+ Here is the caller graph for this function:

◆ isDetached()

bool QPen::isDetached ( )

Definition at line 820 of file qpen.cpp.

References QBasicAtomicInteger< T >::loadRelaxed(), and QSharedData::ref.

+ Here is the call graph for this function:

◆ isSolid()

bool QPen::isSolid ( ) const

Returns true if the pen has a solid fill, otherwise false.

See also
style(), dashPattern()

Definition at line 738 of file qpen.cpp.

References QPenPrivate::brush, Qt::SolidPattern, and QBrush::style().

+ Here is the call graph for this function:

◆ joinStyle()

Qt::PenJoinStyle QPen::joinStyle ( ) const

Returns the pen's join style.

See also
setJoinStyle(), {QPen::Join Style}{Join Style}

Definition at line 663 of file qpen.cpp.

References QPenPrivate::joinStyle.

Referenced by QPainterPathStroker::QPainterPathStroker(), QAlphaPaintEnginePrivate::addPenWidth(), QSvgStrokeStyle::apply(), QPainterPrivate::drawStretchedGradient(), QPainter::setPen(), QPdf::Stroker::setPen(), QCoreGraphicsPaintEnginePrivate::setStrokePen(), QPaintEngineEx::stroke(), QOpenGL2PaintEngineExPrivate::stroke(), QWin32PrintEnginePrivate::strokePath(), QWin32PrintEnginePrivate::strokePath_dev(), and QX11PaintEngine::updatePen().

+ Here is the caller graph for this function:

◆ miterLimit()

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.

See also
setMiterLimit(), {QPen::Join Style}{Join Style}

Definition at line 524 of file qpen.cpp.

References QPenPrivate::miterLimit.

Referenced by QPainterPathStroker::QPainterPathStroker(), QSvgStrokeStyle::apply(), QPainterPrivate::drawStretchedGradient(), QTriangulatingStroker::process(), QDashedStrokeProcessor::process(), QPdf::Stroker::setPen(), QPaintEngineEx::stroke(), QOpenGL2PaintEngineExPrivate::stroke(), QWin32PrintEnginePrivate::strokePath(), and QRasterPaintEngine::updatePen().

+ Here is the caller graph for this function:

◆ operator QVariant()

QPen::operator QVariant ( ) const

Returns the pen as a QVariant.

Definition at line 354 of file qpen.cpp.

References QVariant::fromValue().

+ Here is the call graph for this function:

◆ operator!=()

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.

See also
operator==()

Definition at line 80 of file qpen.h.

References operator==().

+ Here is the call graph for this function:

◆ operator=()

QPen & QPen::operator= ( const QPen & pen)
noexcept

Assigns the given pen to this pen and returns a reference to this pen.

Move-assigns other to this QPen instance.

Since
5.2

Definition at line 329 of file qpen.cpp.

References swap().

+ Here is the call graph for this function:

◆ operator==()

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.

See also
operator!=()

Definition at line 798 of file qpen.cpp.

References QPenPrivate::brush, QPenPrivate::capStyle, QPenPrivate::cosmetic, Qt::CustomDashLine, QPenPrivate::dashOffset, QPenPrivate::dashPattern, QPenPrivate::joinStyle, QPenPrivate::miterLimit, qFuzzyCompare(), QPenPrivate::style, and QPenPrivate::width.

+ Here is the call graph for this function:

◆ setBrush()

void QPen::setBrush ( const QBrush & brush)

Sets the brush used to fill strokes generated with this pen to the given brush.

See also
brush(), setColor()

Definition at line 726 of file qpen.cpp.

References brush(), and QPenPrivate::brush.

Referenced by QSvgStrokeStyle::apply(), QPainterPrivate::drawStretchedGradient(), QGraphicsSimpleTextItem::paint(), QQuickContext2DCommandBuffer::replay(), QEmulationPaintEngine::stroke(), QPdfEngine::updateState(), and src_gui_painting_qpen::Wrapper::wrapper1().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCapStyle()

void QPen::setCapStyle ( Qt::PenCapStyle style)

Sets the pen's cap style to the given style.

The default value is Qt::SquareCap.

See also
capStyle(), {QPen::Cap Style}{Cap Style}

Definition at line 650 of file qpen.cpp.

References QPenPrivate::capStyle.

Referenced by QSvgStrokeStyle::apply(), QPainter::drawPoints(), QPaintEngineEx::drawPoints(), QPainter::drawPoints(), QPaintEngineEx::drawPoints(), drawTextItemDecoration(), generateWavyPixmap(), QQuickBasicDial::paint(), qDrawRoundedCorners(), QQuickContext2DCommandBuffer::replay(), and src_gui_painting_qpen::Wrapper::wrapper1().

+ Here is the caller graph for this function:

◆ setColor()

void QPen::setColor ( const QColor & color)

Sets the color of this pen's brush to the given color.

See also
setBrush(), color()

Definition at line 705 of file qpen.cpp.

References QPenPrivate::brush.

Referenced by QSvgAnimateColor::apply(), QQC2::QCommonStyle::drawControl(), QCommonStyle::drawControl(), drawTextItemDecoration(), QQuickMaterialTextContainer::paint(), QQuickUniversalFocusRectangle::paint(), QPaintEngineEx::stroke(), QQuickMaterialBusyIndicatorNode::updateCurrentTime(), and QPdfEngine::updateState().

+ Here is the caller graph for this function:

◆ setCosmetic()

void QPen::setCosmetic ( bool cosmetic)

Sets this pen to cosmetic or non-cosmetic, depending on the value of cosmetic.

See also
isCosmetic()

Definition at line 770 of file qpen.cpp.

References QPenPrivate::cosmetic.

Referenced by QSvgStrokeStyle::apply(), and QTextLayout::drawCursor().

+ Here is the caller graph for this function:

◆ setDashOffset()

void QPen::setDashOffset ( qreal offset)

Sets the dash offset (the starting point on the dash pattern) for this pen to the offset specified.

The offset is measured in terms of the units used to specify the dash pattern.

\table \row

  • \inlineimage qpen-dashpattern.png
  • For example, a pattern where each stroke is four units long, followed by a gap of two units, will begin with the stroke when drawn as a line.

However, if the dash offset is set to 4.0, any line drawn will begin with the gap. Values of the offset up to 4.0 will cause part of the stroke to be drawn first, and values of the offset between 4.0 and 6.0 will cause the line to begin with part of the gap. \endtable

Note
This implicitly converts the style of the pen to Qt::CustomDashLine.

Definition at line 506 of file qpen.cpp.

References Qt::CustomDashLine, QPenPrivate::dashOffset, dashPattern(), QPenPrivate::dashPattern, qFuzzyCompare(), and QPenPrivate::style.

Referenced by QSvgStrokeStyle::apply(), and QQuickContext2DCommandBuffer::replay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDashPattern()

void QPen::setDashPattern ( const QList< 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 positive entries where the entries 1, 3, 5... are the dashes and 2, 4, 6... are the spaces. For example:

\table 100% \row

  • \inlineimage qpen-custom.png
  • QPen pen;
    QList<qreal> dashes;
    qreal space = 4;
    dashes << 1 << space << 3 << space << 9 << space
    << 27 << space << 9 << space;
    pen.setDashPattern(dashes);
    \endtable

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. Note that a pen with zero width is equivalent to a cosmetic pen with a width of 1 pixel.

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.

See also
setStyle(), dashPattern(), setCapStyle(), setCosmetic()

Definition at line 463 of file qpen.cpp.

References Qt::CustomDashLine, QPenPrivate::dashPattern, qWarning, QList< T >::size(), and QPenPrivate::style.

Referenced by QSvgStrokeStyle::apply(), QQuickUniversalFocusRectangle::paint(), QQuickContext2DCommandBuffer::replay(), QSvgStrokeStyle::setDashArray(), src_gui_painting_qpen::Wrapper::wrapper2(), and src_gui_painting_qpen::Wrapper::wrapper3().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setJoinStyle()

void QPen::setJoinStyle ( Qt::PenJoinStyle style)

Sets the pen's join style to the given style.

The default value is Qt::BevelJoin.

See also
joinStyle(), {QPen::Join Style}{Join Style}

Definition at line 677 of file qpen.cpp.

References j, and QPenPrivate::joinStyle.

Referenced by QSGSoftwareInternalRectangleNode::QSGSoftwareInternalRectangleNode(), QSvgStrokeStyle::apply(), QQuickContext2DCommandBuffer::replay(), QPaintEngineEx::stroke(), and src_gui_painting_qpen::Wrapper::wrapper1().

+ Here is the caller graph for this function:

◆ setMiterLimit()

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.

See also
miterLimit(), setJoinStyle(), {QPen::Join Style}{Join Style}

Definition at line 545 of file qpen.cpp.

References QPenPrivate::miterLimit.

Referenced by QSGSoftwareInternalRectangleNode::QSGSoftwareInternalRectangleNode(), QSvgStyleResolver::QSvgStyleResolver(), QSvgStrokeStyle::apply(), QSvgTinyDocument::draw(), QSvgNode::initPainter(), QQuickContext2DCommandBuffer::replay(), and QSvgNode::transformedBounds().

+ Here is the caller graph for this function:

◆ setStyle()

void QPen::setStyle ( Qt::PenStyle style)

[0]

Sets the pen style to the given style.

See the \l 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.

Note
This function resets the dash offset to zero.
See also
style(), {QPen::Pen Style}{Pen Style}

Definition at line 5 of file doc_src_groups.cpp.

References style(), and QPenPrivate::style.

Referenced by QGraphicsSimpleTextItemPrivate::QGraphicsSimpleTextItemPrivate(), QSvgStrokeStyle::apply(), drawTextItemDecoration(), QPaintEngineEx::stroke(), QRasterPaintEngine::updatePen(), src_gui_painting_qpen::Wrapper::wrapper1(), and src_gui_painting_qpainter2::MyWidget::wrapper15().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWidth()

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 \l {QPainter::Coordinate Transformations}{transformation} set on the painter.

Setting a pen width with a negative value is not supported.

See also
setWidthF(), width()

Definition at line 592 of file qpen.cpp.

References qWarning, width(), and QPenPrivate::width.

Referenced by QQC2::QCommonStyle::drawControl(), QCommonStyle::drawControl(), QQC2_NAMESPACE::QMacStyle::drawPrimitive(), QtWaylandClient::QWaylandBradientDecoration::paint(), QQuickBasicDial::paint(), QQuickMaterialTextContainer::paint(), QQuickUniversalFocusRectangle::paint(), QQuickMaterialBusyIndicatorNode::updateCurrentTime(), and src_gui_painting_qpen::Wrapper::wrapper1().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWidthF()

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 \l {QPainter::Coordinate Transformations}{transformation} on the painter.

Setting a pen width with a negative value is not supported.

See also
setWidth(), widthF()

Definition at line 618 of file qpen.cpp.

References qAbs(), qWarning, width(), and QPenPrivate::width.

Referenced by QSvgStrokeStyle::apply(), QFontEngineBox::draw(), QSvgFont::draw(), QPaintEnginePrivate::drawBoxTextItem(), drawTextItemDecoration(), QQuickMaterialTextContainer::paint(), QQuickContext2DCommandBuffer::replay(), and QSGSoftwareInternalRectangleNode::update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ style()

◆ swap()

void QPen::swap ( QPen & other)
inlinenoexcept
Since
4.8

Swaps pen other with this pen. This operation is very fast and never fails.

Definition at line 42 of file qpen.h.

References d, and other().

Referenced by operator=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ width()

int QPen::width ( ) const

Returns the pen width with integer precision.

See also
setWidth(), widthF()

Definition at line 560 of file qpen.cpp.

References qRound(), and QPenPrivate::width.

Referenced by QQC2::QWindowsStyle::drawPrimitive(), QQuickMaterialTextContainer::paint(), setWidth(), setWidthF(), QQuickMaterialBusyIndicatorNode::updateCurrentTime(), QPicturePaintEngine::updatePen(), and src_gui_painting_qpainter2::MyWidget::wrapper15().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ widthF()

Friends And Related Symbol Documentation

◆ operator<< [1/2]

QDataStream & operator<< ( QDataStream & stream,
const QPen & pen )
friend

Writes the given pen to the given stream and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 840 of file qpen.cpp.

◆ operator<<() [2/2]

QDataStream & operator<< ( QDataStream & stream,
const QPen & pen )
related

Writes the given pen to the given stream and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 840 of file qpen.cpp.

◆ operator>> [1/2]

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.

See also
{Serializing Qt Data Types}

Definition at line 887 of file qpen.cpp.

◆ operator>>() [2/2]

QDataStream & operator>> ( QDataStream & stream,
QPen & pen )
related

Reads a pen from the given stream into the given pen and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 887 of file qpen.cpp.


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