⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qregion.cpp

📁 qt-x11-opensource-src-4.1.4.tar.gz源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
            s >> a;            rgn = QRegion(a, id == QRGN_SETPTARRAY_WIND ? Qt::WindingFill : Qt::OddEvenFill);        } else if (id == QRGN_TRANSLATE) {            QPoint p;            s >> p;            rgn.translate(p.x(), p.y());        } else if (id >= QRGN_OR && id <= QRGN_XOR) {            QByteArray bop1, bop2;            QRegion r1, r2;            s >> bop1;            r1.exec(bop1);            s >> bop2;            r2.exec(bop2);            switch (id) {                case QRGN_OR:                    rgn = r1.unite(r2);                    break;                case QRGN_AND:                    rgn = r1.intersect(r2);                    break;                case QRGN_SUB:                    rgn = r1.subtract(r2);                    break;                case QRGN_XOR:                    rgn = r1.eor(r2);                    break;            }        } else if (id == QRGN_RECTS) {            // (This is the only form used in Qt 2.0)            quint32 n;            s >> n;            QRect r;            for (int i=0; i<(int)n; i++) {                s >> r;                rgn = rgn.unite(QRegion(r));            }        }    }    *this = rgn;}/*****************************************************************************  QRegion stream functions *****************************************************************************//*!    \relates QRegion    Writes the region \a r to the stream \a s and returns a reference    to the stream.    \sa \link datastreamformat.html Format of the QDataStream operators \endlink*/QDataStream &operator<<(QDataStream &s, const QRegion &r){    QVector<QRect> a = r.rects();    if (a.isEmpty()) {        s << (quint32)0;    } else {        if (s.version() == 1) {            int i;            for (i = a.size() - 1; i > 0; --i) {                s << (quint32)(12 + i * 24);                s << (int)QRGN_OR;            }            for (i = 0; i < a.size(); ++i) {                s << (quint32)(4+8) << (int)QRGN_SETRECT << a[i];            }        } else {            s << (quint32)(4 + 4 + 16 * a.size()); // 16: storage size of QRect            s << (qint32)QRGN_RECTS;            s << a;        }    }    return s;}/*!    \relates QRegion    Reads a region from the stream \a s into \a r and returns a    reference to the stream.    \sa \link datastreamformat.html Format of the QDataStream operators \endlink*/QDataStream &operator>>(QDataStream &s, QRegion &r){    QByteArray b;    s >> b;    r.exec(b, s.version());    return s;}#endif //QT_NO_DATASTREAM#ifndef QT_NO_DEBUG_STREAMQDebug operator<<(QDebug s, const QRegion &r){    QVector<QRect> rects = r.rects();    s.nospace() << "QRegion(size=" << rects.size() << "), "                << "bounds = " << r.boundingRect() << "\n";    for (int i=0; i<rects.size(); ++i)        s << "- " << i << rects.at(i) << "\n";    return s;}#endif// These are not inline - they can be implemented better on some platforms//  (eg. Windows at least provides 3-variable operations).  For now, simple./*!    Applies the unite() function to this region and \a r. \c r1|r2 is    equivalent to \c r1.unite(r2)    \sa unite(), operator+()*/const QRegion QRegion::operator|(const QRegion &r) const    { return unite(r); }/*!    Applies the unite() function to this region and \a r. \c r1+r2 is    equivalent to \c r1.unite(r2)    \sa unite(), operator|()*/const QRegion QRegion::operator+(const QRegion &r) const    { return unite(r); }/*!    Applies the intersect() function to this region and \a r. \c r1&r2    is equivalent to \c r1.intersect(r2)    \sa intersect()*/const QRegion QRegion::operator&(const QRegion &r) const    { return intersect(r); }/*!    Applies the subtract() function to this region and \a r. \c r1-r2    is equivalent to \c r1.subtract(r2)    \sa subtract()*/const QRegion QRegion::operator-(const QRegion &r) const    { return subtract(r); }/*!    Applies the eor() function to this region and \a r. \c r1^r2 is    equivalent to \c r1.eor(r2)    \sa eor()*/const QRegion QRegion::operator^(const QRegion &r) const    { return eor(r); }/*!    Applies the unite() function to this region and \a r and assigns    the result to this region. \c r1|=r2 is equivalent to \c    r1=r1.unite(r2).    \sa unite()*/QRegion& QRegion::operator|=(const QRegion &r)    { return *this = *this | r; }/*!    Applies the unite() function to this region and \a r and assigns    the result to this region. \c r1+=r2 is equivalent to \c    r1=r1.unite(r2).    \sa intersect()*/QRegion& QRegion::operator+=(const QRegion &r)    { return *this = *this + r; }/*!    Applies the intersect() function to this region and \a r and    assigns the result to this region. \c r1&=r2 is equivalent to \c    r1=r1.intersect(r2).    \sa intersect()*/QRegion& QRegion::operator&=(const QRegion &r)    { return *this = *this & r; }/*!    Applies the subtract() function to this region and \a r and    assigns the result to this region. \c r1-=r2 is equivalent to \c    r1=r1.subtract(r2).    \sa subtract()*/QRegion& QRegion::operator-=(const QRegion &r)    { return *this = *this - r; }/*!    Applies the eor() function to this region and \a r and    assigns the result to this region. \c r1^=r2 is equivalent to \c    r1=r1.eor(r2).    \sa eor()*/QRegion& QRegion::operator^=(const QRegion &r)    { return *this = *this ^ r; }/*!    \fn bool QRegion::operator!=(const QRegion &other) const    Returns true if this region is different from the \a other region;    otherwise returns false.*//*!   Returns the region as a QVariant*/QRegion::operator QVariant() const{    return QVariant(QVariant::Region, this);}/*!    \fn bool QRegion::isNull() const    Use isEmpty() instead.*//*!    \fn QRegion QRegion::translated(const QPoint &p) const    \overload    \since 4.1    Returns a copy of the regtion that is translated \a{p}\e{.x()}    along the x axis and \a{p}\e{.y()} along the y axis, relative to    the current position.  Positive values move the rectangle to the    right and down.    \sa translate()*//*!    \since 4.1    Returns a copy of the region that is translated \a dx along the    x axis and \a dy along the y axis, relative to the current    position. Positive values move the region to the right and    down.    \sa translate()*/QRegionQRegion::translated(int dx, int dy) const{    QRegion ret(*this);    ret.translate(dx, dy);    return ret;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -