QRegion: remove some toplevel const from return types

It has no effect and inhibits move semantics.

After this change, two and five more copies are moves in QtGui
and QtWidgets, resp.

Keep the old form for compilers that mangle the return type.

Change-Id: I6257683144110230079fe9095303907ecc858c94
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2014-08-24 20:57:40 +02:00
parent a60e13ce06
commit b678cc2989
2 changed files with 39 additions and 8 deletions

View File

@ -450,7 +450,10 @@ QDebug operator<<(QDebug s, const QRegion &r)
\sa united(), operator+() \sa united(), operator+()
*/ */
const QRegion QRegion::operator|(const QRegion &r) const #ifdef Q_COMPILER_MANGLES_RETURN_TYPE
const
#endif
QRegion QRegion::operator|(const QRegion &r) const
{ return united(r); } { return united(r); }
/*! /*!
@ -459,14 +462,20 @@ const QRegion QRegion::operator|(const QRegion &r) const
\sa united(), operator|() \sa united(), operator|()
*/ */
const QRegion QRegion::operator+(const QRegion &r) const #ifdef Q_COMPILER_MANGLES_RETURN_TYPE
const
#endif
QRegion QRegion::operator+(const QRegion &r) const
{ return united(r); } { return united(r); }
/*! /*!
\overload \overload
\since 4.4 \since 4.4
*/ */
const QRegion QRegion::operator+(const QRect &r) const #ifdef Q_COMPILER_MANGLES_RETURN_TYPE
const
#endif
QRegion QRegion::operator+(const QRect &r) const
{ return united(r); } { return united(r); }
/*! /*!
@ -475,14 +484,20 @@ const QRegion QRegion::operator+(const QRect &r) const
\sa intersected() \sa intersected()
*/ */
const QRegion QRegion::operator&(const QRegion &r) const #ifdef Q_COMPILER_MANGLES_RETURN_TYPE
const
#endif
QRegion QRegion::operator&(const QRegion &r) const
{ return intersected(r); } { return intersected(r); }
/*! /*!
\overload \overload
\since 4.4 \since 4.4
*/ */
const QRegion QRegion::operator&(const QRect &r) const #ifdef Q_COMPILER_MANGLES_RETURN_TYPE
const
#endif
QRegion QRegion::operator&(const QRect &r) const
{ {
return intersected(r); return intersected(r);
} }
@ -493,7 +508,10 @@ const QRegion QRegion::operator&(const QRect &r) const
\sa subtracted() \sa subtracted()
*/ */
const QRegion QRegion::operator-(const QRegion &r) const #ifdef Q_COMPILER_MANGLES_RETURN_TYPE
const
#endif
QRegion QRegion::operator-(const QRegion &r) const
{ return subtracted(r); } { return subtracted(r); }
/*! /*!
@ -502,7 +520,10 @@ const QRegion QRegion::operator-(const QRegion &r) const
\sa xored() \sa xored()
*/ */
const QRegion QRegion::operator^(const QRegion &r) const #ifdef Q_COMPILER_MANGLES_RETURN_TYPE
const
#endif
QRegion QRegion::operator^(const QRegion &r) const
{ return xored(r); } { return xored(r); }
/*! /*!

View File

@ -112,7 +112,8 @@ public:
QVector<QRect> rects() const; QVector<QRect> rects() const;
void setRects(const QRect *rect, int num); void setRects(const QRect *rect, int num);
int rectCount() const; int rectCount() const;
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
// ### Qt 6: remove these, they're kept for MSVC compat
const QRegion operator|(const QRegion &r) const; const QRegion operator|(const QRegion &r) const;
const QRegion operator+(const QRegion &r) const; const QRegion operator+(const QRegion &r) const;
const QRegion operator+(const QRect &r) const; const QRegion operator+(const QRect &r) const;
@ -120,6 +121,15 @@ public:
const QRegion operator&(const QRect &r) const; const QRegion operator&(const QRect &r) const;
const QRegion operator-(const QRegion &r) const; const QRegion operator-(const QRegion &r) const;
const QRegion operator^(const QRegion &r) const; const QRegion operator^(const QRegion &r) const;
#else
QRegion operator|(const QRegion &r) const;
QRegion operator+(const QRegion &r) const;
QRegion operator+(const QRect &r) const;
QRegion operator&(const QRegion &r) const;
QRegion operator&(const QRect &r) const;
QRegion operator-(const QRegion &r) const;
QRegion operator^(const QRegion &r) const;
#endif // Q_COMPILER_MANGLES_RETURN_TYPE
QRegion& operator|=(const QRegion &r); QRegion& operator|=(const QRegion &r);
QRegion& operator+=(const QRegion &r); QRegion& operator+=(const QRegion &r);
QRegion& operator+=(const QRect &r); QRegion& operator+=(const QRect &r);