File indexing completed on 2025-01-18 10:08:15
0001
0002
0003
0004 #ifndef QPEN_H
0005 #define QPEN_H
0006
0007 #include <QtCore/qshareddata.h>
0008 #include <QtGui/qtguiglobal.h>
0009 #include <QtGui/qcolor.h>
0010 #include <QtGui/qbrush.h>
0011
0012 QT_BEGIN_NAMESPACE
0013
0014
0015 class QVariant;
0016 class QPenPrivate;
0017 class QBrush;
0018 class QPen;
0019
0020 #ifndef QT_NO_DATASTREAM
0021 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &);
0022 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &);
0023 #endif
0024
0025 QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPenPrivate, Q_GUI_EXPORT)
0026
0027 class Q_GUI_EXPORT QPen
0028 {
0029 public:
0030 QPen();
0031 QPen(Qt::PenStyle);
0032 QPen(const QColor &color);
0033 QPen(const QBrush &brush, qreal width, Qt::PenStyle s = Qt::SolidLine,
0034 Qt::PenCapStyle c = Qt::SquareCap, Qt::PenJoinStyle j = Qt::BevelJoin);
0035 QPen(const QPen &pen) noexcept;
0036
0037 ~QPen();
0038
0039 QPen &operator=(const QPen &pen) noexcept;
0040 QPen(QPen &&other) noexcept = default;
0041 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPen)
0042 void swap(QPen &other) noexcept { d.swap(other.d); }
0043
0044 Qt::PenStyle style() const;
0045 void setStyle(Qt::PenStyle);
0046
0047 QList<qreal> dashPattern() const;
0048 void setDashPattern(const QList<qreal> &pattern);
0049
0050 qreal dashOffset() const;
0051 void setDashOffset(qreal doffset);
0052
0053 qreal miterLimit() const;
0054 void setMiterLimit(qreal limit);
0055
0056 qreal widthF() const;
0057 void setWidthF(qreal width);
0058
0059 int width() const;
0060 void setWidth(int width);
0061
0062 QColor color() const;
0063 void setColor(const QColor &color);
0064
0065 QBrush brush() const;
0066 void setBrush(const QBrush &brush);
0067
0068 bool isSolid() const;
0069
0070 Qt::PenCapStyle capStyle() const;
0071 void setCapStyle(Qt::PenCapStyle pcs);
0072
0073 Qt::PenJoinStyle joinStyle() const;
0074 void setJoinStyle(Qt::PenJoinStyle pcs);
0075
0076 bool isCosmetic() const;
0077 void setCosmetic(bool cosmetic);
0078
0079 bool operator==(const QPen &p) const;
0080 inline bool operator!=(const QPen &p) const { return !(operator==(p)); }
0081 operator QVariant() const;
0082
0083 bool isDetached();
0084
0085 private:
0086 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &);
0087 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &);
0088
0089 public:
0090 using DataPtr = QExplicitlySharedDataPointer<QPenPrivate>;
0091
0092 private:
0093 void detach();
0094 DataPtr d;
0095
0096 public:
0097 inline DataPtr &data_ptr() { return d; }
0098 };
0099
0100 Q_DECLARE_SHARED(QPen)
0101
0102 #ifndef QT_NO_DEBUG_STREAM
0103 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPen &);
0104 #endif
0105
0106 QT_END_NAMESPACE
0107
0108 #endif