Warning, file /include/QtGui/qregion.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 QREGION_H
0005 #define QREGION_H
0006
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qatomic.h>
0009 #include <QtCore/qrect.h>
0010 #include <QtGui/qwindowdefs.h>
0011 #include <QtCore/qcontainerfwd.h>
0012
0013 #ifndef QT_NO_DATASTREAM
0014 #include <QtCore/qdatastream.h>
0015 #endif
0016
0017 QT_BEGIN_NAMESPACE
0018
0019
0020 class QVariant;
0021
0022 struct QRegionPrivate;
0023
0024 class QBitmap;
0025
0026 class Q_GUI_EXPORT QRegion
0027 {
0028 public:
0029 enum RegionType { Rectangle, Ellipse };
0030
0031 QRegion();
0032 QRegion(int x, int y, int w, int h, RegionType t = Rectangle);
0033 QRegion(const QRect &r, RegionType t = Rectangle);
0034 QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill);
0035 QRegion(const QRegion ®ion);
0036 QRegion(QRegion &&other) noexcept
0037 : d(std::exchange(other.d, const_cast<QRegionData*>(&shared_empty))) {}
0038 QRegion(const QBitmap &bitmap);
0039 ~QRegion();
0040 QRegion &operator=(const QRegion &);
0041 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QRegion)
0042 void swap(QRegion &other) noexcept { qt_ptr_swap(d, other.d); }
0043 bool isEmpty() const;
0044 bool isNull() const;
0045
0046 typedef const QRect *const_iterator;
0047 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
0048
0049 const_iterator begin() const noexcept;
0050 const_iterator cbegin() const noexcept { return begin(); }
0051 const_iterator end() const noexcept;
0052 const_iterator cend() const noexcept { return end(); }
0053 const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
0054 const_reverse_iterator crbegin() const noexcept { return rbegin(); }
0055 const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
0056 const_reverse_iterator crend() const noexcept { return rend(); }
0057
0058 bool contains(const QPoint &p) const;
0059 bool contains(const QRect &r) const;
0060
0061 void translate(int dx, int dy);
0062 inline void translate(const QPoint &p) { translate(p.x(), p.y()); }
0063 [[nodiscard]] QRegion translated(int dx, int dy) const;
0064 [[nodiscard]] inline QRegion translated(const QPoint &p) const { return translated(p.x(), p.y()); }
0065
0066 [[nodiscard]] QRegion united(const QRegion &r) const;
0067 [[nodiscard]] QRegion united(const QRect &r) const;
0068 [[nodiscard]] QRegion intersected(const QRegion &r) const;
0069 [[nodiscard]] QRegion intersected(const QRect &r) const;
0070 [[nodiscard]] QRegion subtracted(const QRegion &r) const;
0071 [[nodiscard]] QRegion xored(const QRegion &r) const;
0072
0073 bool intersects(const QRegion &r) const;
0074 bool intersects(const QRect &r) const;
0075
0076 QRect boundingRect() const noexcept;
0077 void setRects(const QRect *rect, int num);
0078 int rectCount() const noexcept;
0079
0080 QRegion operator|(const QRegion &r) const;
0081 QRegion operator+(const QRegion &r) const;
0082 QRegion operator+(const QRect &r) const;
0083 QRegion operator&(const QRegion &r) const;
0084 QRegion operator&(const QRect &r) const;
0085 QRegion operator-(const QRegion &r) const;
0086 QRegion operator^(const QRegion &r) const;
0087
0088 QRegion& operator|=(const QRegion &r);
0089 QRegion& operator+=(const QRegion &r);
0090 QRegion& operator+=(const QRect &r);
0091 QRegion& operator&=(const QRegion &r);
0092 QRegion& operator&=(const QRect &r);
0093 QRegion& operator-=(const QRegion &r);
0094 QRegion& operator^=(const QRegion &r);
0095
0096 bool operator==(const QRegion &r) const;
0097 inline bool operator!=(const QRegion &r) const { return !(operator==(r)); }
0098 operator QVariant() const;
0099
0100
0101 #if defined(Q_OS_WIN) || defined(Q_QDOC)
0102 HRGN toHRGN() const;
0103 static QRegion fromHRGN(HRGN hrgn);
0104 #endif
0105
0106 #ifndef QT_NO_DATASTREAM
0107 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QRegion &);
0108 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QRegion &);
0109 #endif
0110 private:
0111 QRegion copy() const;
0112 void detach();
0113 Q_GUI_EXPORT
0114 friend bool qt_region_strictContains(const QRegion ®ion,
0115 const QRect &rect);
0116 friend struct QRegionPrivate;
0117
0118 #ifndef QT_NO_DATASTREAM
0119 void exec(const QByteArray &ba, int ver = 0, QDataStream::ByteOrder byteOrder = QDataStream::BigEndian);
0120 #endif
0121 struct QRegionData {
0122 QtPrivate::RefCount ref;
0123 QRegionPrivate *qt_rgn;
0124 };
0125 struct QRegionData *d;
0126 static const struct QRegionData shared_empty;
0127 static void cleanUp(QRegionData *x);
0128 };
0129 Q_DECLARE_SHARED(QRegion)
0130
0131
0132
0133
0134
0135 #ifndef QT_NO_DATASTREAM
0136 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QRegion &);
0137 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QRegion &);
0138 #endif
0139
0140 #ifndef QT_NO_DEBUG_STREAM
0141 Q_GUI_EXPORT QDebug operator<<(QDebug, const QRegion &);
0142 #endif
0143
0144 QT_END_NAMESPACE
0145
0146 #endif