194 : dashOffset(0), miterLimit(2),
230 d = defaultPenInstance()->pen;
403 return QList<qreal>();
405 const qreal space = 2;
407 const qreal dash = 4;
473 qWarning(
"QPen::setDashPattern: Pattern not of even length");
594 if (width < 0 || width >= (1 << 15)) {
595 qWarning(
"QPen::setWidth: Setting a pen width that is out of range");
620 if (width < 0.f || width >= (1 << 15)) {
621 qWarning(
"QPen::setWidthF: Setting a pen width that is out of range");
801 || (
p.d->style == d->
style
829#ifndef QT_NO_DATASTREAM
842 if (
s.version() < 3) {
844 }
else if (
s.version() < QDataStream::Qt_4_3) {
848 s << (bool)(
p.d->cosmetic);
851 if (
s.version() < 7) {
855 s << double(
p.widthF());
857 s << double(
p.miterLimit());
858 if (
sizeof(
qreal) ==
sizeof(
double)) {
859 s <<
p.dashPattern();
864 QList<qreal>
pattern =
p.dashPattern();
869 if (
s.version() >= 9)
870 s << double(
p.dashOffset());
871 if (
s.version() >= QDataStream::Qt_5_0)
894 double miterLimit = 2;
895 QList<qreal> dashPattern;
896 double dashOffset = 0;
897 bool cosmetic =
false;
899 if (
s.version() < QDataStream::Qt_4_3) {
907 if (
s.version() < 7) {
916 if (
sizeof(
qreal) ==
sizeof(
double)) {
922 dashPattern.reserve(numDashes);
928 if (
s.version() >= 9)
932 if (
s.version() >= QDataStream::Qt_5_0) {
942 p.d->dashPattern = dashPattern;
943 p.d->miterLimit = miterLimit;
944 p.d->dashOffset = dashOffset;
945 p.d->cosmetic = cosmetic;
951#ifndef QT_NO_DEBUG_STREAM
954 const char *PEN_STYLES[] = {
965 dbg.nospace() <<
"QPen(" <<
p.width() <<
',' <<
p.brush()
966 <<
',' << PEN_STYLES[
p.style()] <<
',' << int(
p.capStyle())
967 <<
',' << int(
p.joinStyle()) <<
',' <<
p.dashPattern()
968 <<
',' <<
p.dashOffset()
969 <<
',' <<
p.miterLimit() <<
')';
987#undef QT_COMPILING_QPEN
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 detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
qsizetype size() const noexcept
bool isEmpty() const noexcept
void reserve(qsizetype size)
QPenDataHolder(const QBrush &brush, qreal width, Qt::PenStyle penStyle, Qt::PenCapStyle penCapStyle, Qt::PenJoinStyle _joinStyle)
~QPenDataHolder()=default
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)
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)
QDataStream & operator<<(QDataStream &s, const QPen &p)
#define QT_DEFINE_QESDP_SPECIALIZATION_DTOR(Class)