QRegion: add move ctor
After this change, this was the distribution of calls in QtGui and QtWidgets when the patch was developed for 5.4: QtGui QtWidgets move 23 63 copy 23 36 Change-Id: If3f536e52fc242c585e7fa0662049c0657efcc9c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
parent
0df5c366e5
commit
afc7da09ec
@ -209,6 +209,16 @@ QT_BEGIN_NAMESPACE
|
|||||||
Constructs a new region which is equal to region \a r.
|
Constructs a new region which is equal to region \a r.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QRegion::QRegion(QRegion &&other)
|
||||||
|
\since 5.7
|
||||||
|
|
||||||
|
Move-constructs a new region from region \a other.
|
||||||
|
After the call, \a other is null.
|
||||||
|
|
||||||
|
\sa isNull()
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QRegion::QRegion(const QBitmap &bm)
|
\fn QRegion::QRegion(const QBitmap &bm)
|
||||||
|
|
||||||
|
@ -68,6 +68,8 @@ public:
|
|||||||
QRegion(const QRect &r, RegionType t = Rectangle);
|
QRegion(const QRect &r, RegionType t = Rectangle);
|
||||||
QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill);
|
QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill);
|
||||||
QRegion(const QRegion ®ion);
|
QRegion(const QRegion ®ion);
|
||||||
|
QRegion(QRegion &&other) Q_DECL_NOTHROW
|
||||||
|
: d(other.d) { other.d = const_cast<QRegionData*>(&shared_empty); }
|
||||||
QRegion(const QBitmap &bitmap);
|
QRegion(const QBitmap &bitmap);
|
||||||
~QRegion();
|
~QRegion();
|
||||||
QRegion &operator=(const QRegion &);
|
QRegion &operator=(const QRegion &);
|
||||||
|
@ -45,6 +45,7 @@ public:
|
|||||||
tst_QRegion();
|
tst_QRegion();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void moveSemantics();
|
||||||
void boundingRect();
|
void boundingRect();
|
||||||
void rects();
|
void rects();
|
||||||
void swap();
|
void swap();
|
||||||
@ -93,6 +94,28 @@ tst_QRegion::tst_QRegion()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QRegion::moveSemantics()
|
||||||
|
{
|
||||||
|
const QRegion rect(QRect(0, 0, 100, 100));
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
{
|
||||||
|
QRegion r1 = rect;
|
||||||
|
QRegion r2;
|
||||||
|
r2 = std::move(r1);
|
||||||
|
QVERIFY(r1.isNull());
|
||||||
|
QCOMPARE(r2, rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
// move construction
|
||||||
|
{
|
||||||
|
QRegion r1 = rect;
|
||||||
|
QRegion r2 = std::move(r1);
|
||||||
|
QVERIFY(r1.isNull());
|
||||||
|
QCOMPARE(r2, rect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QRegion::boundingRect()
|
void tst_QRegion::boundingRect()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user