Warning, file /include/QtGui/qpolygon.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QPOLYGON_H
0005 #define QPOLYGON_H
0006
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qlist.h>
0009 #include <QtCore/qpoint.h>
0010 #include <QtCore/qrect.h>
0011
0012 QT_BEGIN_NAMESPACE
0013
0014 class QTransform;
0015 class QRect;
0016 class QVariant;
0017
0018 class QPolygonF;
0019
0020
0021
0022 class QPolygon : public QList<QPoint>
0023 {
0024 public:
0025 using QList<QPoint>::QList;
0026 QPolygon() = default;
0027 Q_IMPLICIT QPolygon(const QList<QPoint> &v) : QList<QPoint>(v) { }
0028 Q_IMPLICIT QPolygon(QList<QPoint> &&v) noexcept : QList<QPoint>(std::move(v)) { }
0029 Q_IMPLICIT Q_GUI_EXPORT QPolygon(const QRect &r, bool closed=false);
0030 Q_GUI_EXPORT QPolygon(int nPoints, const int *points);
0031 void swap(QPolygon &other) noexcept { QList<QPoint>::swap(other); }
0032
0033 Q_GUI_EXPORT operator QVariant() const;
0034
0035 Q_GUI_EXPORT void translate(int dx, int dy);
0036 void translate(const QPoint &offset);
0037
0038 [[nodiscard]] Q_GUI_EXPORT QPolygon translated(int dx, int dy) const;
0039 [[nodiscard]] inline QPolygon translated(const QPoint &offset) const;
0040
0041 Q_GUI_EXPORT QRect boundingRect() const;
0042
0043 Q_GUI_EXPORT void point(int i, int *x, int *y) const;
0044 QPoint point(int i) const;
0045 Q_GUI_EXPORT void setPoint(int index, int x, int y);
0046 inline void setPoint(int index, const QPoint &p);
0047 Q_GUI_EXPORT void setPoints(int nPoints, const int *points);
0048 Q_GUI_EXPORT void setPoints(int nPoints, int firstx, int firsty, ...);
0049 Q_GUI_EXPORT void putPoints(int index, int nPoints, const int *points);
0050 Q_GUI_EXPORT void putPoints(int index, int nPoints, int firstx, int firsty, ...);
0051 Q_GUI_EXPORT void putPoints(int index, int nPoints, const QPolygon & from, int fromIndex=0);
0052
0053 Q_GUI_EXPORT bool containsPoint(const QPoint &pt, Qt::FillRule fillRule) const;
0054
0055 [[nodiscard]] Q_GUI_EXPORT QPolygon united(const QPolygon &r) const;
0056 [[nodiscard]] Q_GUI_EXPORT QPolygon intersected(const QPolygon &r) const;
0057 [[nodiscard]] Q_GUI_EXPORT QPolygon subtracted(const QPolygon &r) const;
0058
0059 Q_GUI_EXPORT bool intersects(const QPolygon &r) const;
0060
0061 [[nodiscard]] inline QPolygonF toPolygonF() const;
0062 };
0063 Q_DECLARE_SHARED(QPolygon)
0064
0065 #ifndef QT_NO_DEBUG_STREAM
0066 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygon &);
0067 #endif
0068
0069
0070
0071
0072 #ifndef QT_NO_DATASTREAM
0073 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPolygon &polygon);
0074 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygon &polygon);
0075 #endif
0076
0077
0078
0079
0080
0081 inline void QPolygon::setPoint(int index, const QPoint &pt)
0082 { setPoint(index, pt.x(), pt.y()); }
0083
0084 inline QPoint QPolygon::point(int index) const
0085 { return at(index); }
0086
0087 inline void QPolygon::translate(const QPoint &offset)
0088 { translate(offset.x(), offset.y()); }
0089
0090 inline QPolygon QPolygon::translated(const QPoint &offset) const
0091 { return translated(offset.x(), offset.y()); }
0092
0093 class QRectF;
0094
0095 class QPolygonF : public QList<QPointF>
0096 {
0097 public:
0098 using QList<QPointF>::QList;
0099 QPolygonF() = default;
0100 Q_IMPLICIT QPolygonF(const QList<QPointF> &v) : QList<QPointF>(v) { }
0101 Q_IMPLICIT QPolygonF(QList<QPointF> &&v) noexcept : QList<QPointF>(std::move(v)) { }
0102 Q_IMPLICIT Q_GUI_EXPORT QPolygonF(const QRectF &r);
0103 Q_IMPLICIT Q_GUI_EXPORT QPolygonF(const QPolygon &a);
0104 inline void swap(QPolygonF &other) { QList<QPointF>::swap(other); }
0105
0106 Q_GUI_EXPORT operator QVariant() const;
0107
0108 inline void translate(qreal dx, qreal dy);
0109 void Q_GUI_EXPORT translate(const QPointF &offset);
0110
0111 inline QPolygonF translated(qreal dx, qreal dy) const;
0112 [[nodiscard]] Q_GUI_EXPORT QPolygonF translated(const QPointF &offset) const;
0113
0114 QPolygon Q_GUI_EXPORT toPolygon() const;
0115
0116 bool isClosed() const { return !isEmpty() && first() == last(); }
0117
0118 QRectF Q_GUI_EXPORT boundingRect() const;
0119
0120 Q_GUI_EXPORT bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const;
0121
0122 [[nodiscard]] Q_GUI_EXPORT QPolygonF united(const QPolygonF &r) const;
0123 [[nodiscard]] Q_GUI_EXPORT QPolygonF intersected(const QPolygonF &r) const;
0124 [[nodiscard]] Q_GUI_EXPORT QPolygonF subtracted(const QPolygonF &r) const;
0125
0126 Q_GUI_EXPORT bool intersects(const QPolygonF &r) const;
0127 };
0128 Q_DECLARE_SHARED(QPolygonF)
0129
0130 QPolygonF QPolygon::toPolygonF() const { return QPolygonF(*this); }
0131
0132 #ifndef QT_NO_DEBUG_STREAM
0133 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygonF &);
0134 #endif
0135
0136
0137
0138
0139 #ifndef QT_NO_DATASTREAM
0140 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPolygonF &array);
0141 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygonF &array);
0142 #endif
0143
0144 inline void QPolygonF::translate(qreal dx, qreal dy)
0145 { translate(QPointF(dx, dy)); }
0146
0147 inline QPolygonF QPolygonF::translated(qreal dx, qreal dy) const
0148 { return translated(QPointF(dx, dy)); }
0149
0150 QT_END_NAMESPACE
0151
0152 #endif