/work/prefix/include/QtGui/qpen.h
Line | Count | Source |
1 | | // Copyright (C) 2016 The Qt Company Ltd. |
2 | | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | | // Qt-Security score:significant reason:default |
4 | | |
5 | | #ifndef QPEN_H |
6 | | #define QPEN_H |
7 | | |
8 | | #include <QtCore/qshareddata.h> |
9 | | #include <QtGui/qtguiglobal.h> |
10 | | #include <QtGui/qcolor.h> |
11 | | #include <QtGui/qbrush.h> |
12 | | |
13 | | QT_BEGIN_NAMESPACE |
14 | | |
15 | | |
16 | | class QVariant; |
17 | | class QPenPrivate; |
18 | | class QBrush; |
19 | | class QPen; |
20 | | |
21 | | #ifndef QT_NO_DATASTREAM |
22 | | Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &); |
23 | | Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &); |
24 | | #endif |
25 | | |
26 | | QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPenPrivate, Q_GUI_EXPORT) |
27 | | |
28 | | class Q_GUI_EXPORT QPen |
29 | | { |
30 | | public: |
31 | | QPen(); |
32 | | QPen(Qt::PenStyle); |
33 | | QPen(const QColor &color); |
34 | | QPen(const QBrush &brush, qreal width, Qt::PenStyle s = Qt::SolidLine, |
35 | | Qt::PenCapStyle c = Qt::SquareCap, Qt::PenJoinStyle j = Qt::BevelJoin); |
36 | | QPen(const QPen &pen) noexcept; |
37 | | |
38 | | ~QPen(); |
39 | | |
40 | | QPen &operator=(const QPen &pen) noexcept; |
41 | | QPen(QPen &&other) noexcept = default; |
42 | | QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPen) |
43 | 0 | void swap(QPen &other) noexcept { d.swap(other.d); } |
44 | | |
45 | | QPen &operator=(QColor color); |
46 | | QPen &operator=(Qt::PenStyle style); |
47 | | |
48 | | Qt::PenStyle style() const; |
49 | | void setStyle(Qt::PenStyle); |
50 | | |
51 | | QList<qreal> dashPattern() const; |
52 | | void setDashPattern(const QList<qreal> &pattern); |
53 | | |
54 | | qreal dashOffset() const; |
55 | | void setDashOffset(qreal doffset); |
56 | | |
57 | | qreal miterLimit() const; |
58 | | void setMiterLimit(qreal limit); |
59 | | |
60 | | qreal widthF() const; |
61 | | void setWidthF(qreal width); |
62 | | |
63 | | int width() const; |
64 | | void setWidth(int width); |
65 | | |
66 | | QColor color() const; |
67 | | void setColor(const QColor &color); |
68 | | |
69 | | QBrush brush() const; |
70 | | void setBrush(const QBrush &brush); |
71 | | |
72 | | bool isSolid() const; |
73 | | |
74 | | Qt::PenCapStyle capStyle() const; |
75 | | void setCapStyle(Qt::PenCapStyle pcs); |
76 | | |
77 | | Qt::PenJoinStyle joinStyle() const; |
78 | | void setJoinStyle(Qt::PenJoinStyle pcs); |
79 | | |
80 | | bool isCosmetic() const; |
81 | | void setCosmetic(bool cosmetic); |
82 | | |
83 | | bool operator==(const QPen &p) const; |
84 | 0 | inline bool operator!=(const QPen &p) const { return !(operator==(p)); } |
85 | | operator QVariant() const; |
86 | | |
87 | | bool isDetached(); |
88 | | |
89 | | private: |
90 | | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &); |
91 | | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &); |
92 | | |
93 | | bool isSolidDefaultLine() const noexcept; |
94 | | |
95 | | bool doCompareEqualColor(QColor rhs) const noexcept; |
96 | | friend bool comparesEqual(const QPen &lhs, QColor rhs) noexcept |
97 | 0 | { |
98 | 0 | return lhs.doCompareEqualColor(rhs); |
99 | 0 | } |
100 | | Q_DECLARE_EQUALITY_COMPARABLE(QPen, QColor) |
101 | | |
102 | | bool doCompareEqualStyle(Qt::PenStyle rhs) const; |
103 | | friend bool comparesEqual(const QPen &lhs, Qt::PenStyle rhs) |
104 | 0 | { |
105 | 0 | return lhs.doCompareEqualStyle(rhs); |
106 | 0 | } |
107 | | Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QPen, Qt::PenStyle) |
108 | | |
109 | | public: |
110 | | using DataPtr = QExplicitlySharedDataPointer<QPenPrivate>; |
111 | | |
112 | | private: |
113 | | void detach(); |
114 | | DataPtr d; |
115 | | |
116 | | public: |
117 | 0 | inline DataPtr &data_ptr() { return d; } |
118 | | }; |
119 | | |
120 | | Q_DECLARE_SHARED(QPen) |
121 | | |
122 | | #ifndef QT_NO_DEBUG_STREAM |
123 | | Q_GUI_EXPORT QDebug operator<<(QDebug, const QPen &); |
124 | | #endif |
125 | | |
126 | | QT_END_NAMESPACE |
127 | | |
128 | | #endif // QPEN_H |