196 :
ref(1), dashOffset(0), miterLimit(2),
219 if (!
pen->ref.deref())
236 d = defaultPenInstance()->pen;
425 }
else if (dd->dashPattern.isEmpty()) {
426 const qreal space = 2;
428 const qreal dash = 4;
432 dd->dashPattern.reserve(2);
433 dd->dashPattern << dash << space;
436 dd->dashPattern.reserve(2);
437 dd->dashPattern <<
dot << space;
440 dd->dashPattern.reserve(4);
441 dd->dashPattern << dash << space <<
dot << space;
444 dd->dashPattern.reserve(6);
445 dd->dashPattern << dash << space <<
dot << space <<
dot << space;
451 return dd->dashPattern;
494 if ((dd->dashPattern.size() % 2) == 1) {
495 qWarning(
"QPen::setDashPattern: Pattern not of even length");
496 dd->dashPattern << 1;
620 if (width < 0 || width >= (1 << 15)) {
621 qWarning(
"QPen::setWidth: Setting a pen width that is out of range");
646 if (width < 0.f || width >= (1 << 15)) {
647 qWarning(
"QPen::setWidthF: Setting a pen width that is out of range");
786 return (dd->cosmetic ==
true) || d->
width == 0;
831 || (
p.d->style == d->
style
835 && pdd->miterLimit == dd->miterLimit
838 pdd->dashPattern == dd->dashPattern))
840 && pdd->cosmetic == dd->cosmetic);
859#ifndef QT_NO_DATASTREAM
873 if (
s.version() < 3) {
879 s << (bool)(dd->cosmetic);
882 if (
s.version() < 7) {
886 s << double(
p.widthF());
888 s << double(
p.miterLimit());
889 if (
sizeof(
qreal) ==
sizeof(
double)) {
890 s <<
p.dashPattern();
900 if (
s.version() >= 9)
901 s << double(
p.dashOffset());
925 double miterLimit = 2;
927 double dashOffset = 0;
928 bool cosmetic =
false;
938 if (
s.version() < 7) {
947 if (
sizeof(
qreal) ==
sizeof(
double)) {
953 dashPattern.
reserve(numDashes);
959 if (
s.version() >= 9)
974 dd->dashPattern = dashPattern;
975 dd->miterLimit = miterLimit;
976 dd->dashOffset = dashOffset;
977 dd->cosmetic = cosmetic;
983#ifndef QT_NO_DEBUG_STREAM
986 const char *PEN_STYLES[] = {
997 dbg.nospace() <<
"QPen(" <<
p.width() <<
',' <<
p.brush()
998 <<
',' << PEN_STYLES[
p.style()] <<
',' << int(
p.capStyle())
999 <<
',' << int(
p.joinStyle()) <<
',' <<
p.dashPattern()
1000 <<
',' <<
p.dashOffset()
1001 <<
',' <<
p.miterLimit() <<
')';
1019#undef QT_COMPILING_QPEN
void storeRelaxed(T newValue) noexcept
T loadRelaxed() const noexcept
const QColor & color() const
Returns the brush color.
Qt::BrushStyle style() const
Returns the brush style.
The QColor class provides colors based on RGB, HSV or CMYK values.
\inmodule QtCore\reentrant
void reserve(qsizetype size)
QPenDataHolder(const QBrush &brush, qreal width, Qt::PenStyle penStyle, Qt::PenCapStyle penCapStyle, Qt::PenJoinStyle _joinStyle)
QPenPrivate(const QBrush &brush, qreal width, Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle _joinStyle)
QList< qreal > dashPattern
Qt::PenJoinStyle joinStyle
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen's cap style to the given style.
qreal widthF() const
Returns the pen width with floating point precision.
void setStyle(Qt::PenStyle)
[0]
QList< qreal > dashPattern() const
Returns the dash pattern of this pen.
QPen()
Constructs a default black solid line pen with 1 width.
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
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 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.
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
void swap(QPen &other) noexcept
void setColor(const QColor &color)
Sets the color of this pen's brush to the given color.
void setBrush(const QBrush &brush)
Sets the brush used to fill strokes generated with this pen to the given brush.
void setJoinStyle(Qt::PenJoinStyle pcs)
Sets the pen's join style to the given style.
void setDashOffset(qreal doffset)
Sets the dash offset (the starting point on the dash pattern) for this pen to the offset specified.
void setMiterLimit(qreal limit)
Sets the miter limit of this pen to the given limit.
QPen & operator=(const QPen &pen) noexcept
Assigns the given pen to this pen and returns a reference to this pen.
bool operator==(const QPen &p) const
Returns true if the pen is equal to the given pen; otherwise false.
bool isSolid() const
Returns true if the pen has a solid fill, otherwise false.
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
void setCosmetic(bool cosmetic)
Sets this pen to cosmetic or non-cosmetic, depending on the value of cosmetic.
void setDashPattern(const QList< qreal > &pattern)
Sets the dash pattern for this pen to the given pattern.
qreal miterLimit() const
Returns the miter limit of the pen.
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
qreal dashOffset() const
Returns the dash offset for the pen.
Qt::PenStyle style() const
Returns the pen style.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Combined button and popup list for selecting options.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)
constexpr T qAbs(const T &t)
GLint GLint GLint GLint GLint x
[0]
GLenum GLuint GLintptr offset
static qreal dot(const QPointF &a, const QPointF &b)
static const Qt::PenCapStyle qpen_default_cap
static const Qt::PenJoinStyle qpen_default_join
QDataStream & operator>>(QDataStream &s, QPen &p)
QT_BEGIN_NAMESPACE typedef QPenPrivate QPenData
QDataStream & operator<<(QDataStream &s, const QPen &p)