summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2022-09-26 17:38:14 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2022-09-28 17:39:21 +0000
commita0dfa8c4d29a005009d04dcb52452efb9d74e26e (patch)
tree7b400e7a8fc2dd2db99d780e94ff4bf1b63ce375 /src/gui
parentd06d22fbc0ef1d070408fe7e1f6a5c33e6f8c4e2 (diff)
Replace qExchange calls with std::exchange
qExchange is one of the few remaining functionalities that have not been moved out of qglobal. Given that std::exchange exists in the standard, we can simply move to it everywhere... ...if it weren't for the fact that std::exchange is only constexpr in C++20, and only has its noexceptness specified in (most likely) C++23. Still, we want to move to the existing std functionality where possible, to allow the removal of qglobal includes in lieu of something more fine-grained in the future. So leave any constexpr calls[1] alone for now (and observe that none of our current usages cares about the conditional noexceptness), but replace everything else. [1] QScopedValueRollback' ctor and QExplicitlySharedDataPointerV2::take Task-number: QTBUG-99313 Change-Id: I599cb9846cf319c7ffd3457130938347a75aad25 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qicon.h2
-rw-r--r--src/gui/image/qimage.h2
-rw-r--r--src/gui/kernel/qcursor.h2
-rw-r--r--src/gui/kernel/qpalette.h2
-rw-r--r--src/gui/painting/qpen.h2
-rw-r--r--src/gui/painting/qregion.h2
-rw-r--r--src/gui/text/qfontengine_p.h4
7 files changed, 8 insertions, 8 deletions
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index 63816220dd..22f63b1ecb 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -26,7 +26,7 @@ public:
QIcon(const QPixmap &pixmap);
QIcon(const QIcon &other);
QIcon(QIcon &&other) noexcept
- : d(qExchange(other.d, nullptr))
+ : d(std::exchange(other.d, nullptr))
{}
explicit QIcon(const QString &fileName); // file or resource name
explicit QIcon(QIconEngine *engine);
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index aa58af4a76..86c49ac28a 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -96,7 +96,7 @@ public:
QImage(const QImage &);
QImage(QImage &&other) noexcept
- : QPaintDevice(), d(qExchange(other.d, nullptr))
+ : QPaintDevice(), d(std::exchange(other.d, nullptr))
{}
~QImage();
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 1d94d65ce4..3aeef52094 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -51,7 +51,7 @@ public:
QCursor(const QCursor &cursor);
~QCursor();
QCursor &operator=(const QCursor &cursor);
- QCursor(QCursor &&other) noexcept : d(qExchange(other.d, nullptr)) {}
+ QCursor(QCursor &&other) noexcept : d(std::exchange(other.d, nullptr)) {}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCursor)
void swap(QCursor &other) noexcept { qt_ptr_swap(d, other.d); }
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index a9b1b59eb5..0a6dc0b381 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -32,7 +32,7 @@ public:
~QPalette();
QPalette &operator=(const QPalette &palette);
QPalette(QPalette &&other) noexcept
- : d(qExchange(other.d, nullptr)), currentGroup(other.currentGroup)
+ : d(std::exchange(other.d, nullptr)), currentGroup(other.currentGroup)
{}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPalette)
diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h
index d8f13df388..2f38098496 100644
--- a/src/gui/painting/qpen.h
+++ b/src/gui/painting/qpen.h
@@ -35,7 +35,7 @@ public:
QPen &operator=(const QPen &pen) noexcept;
QPen(QPen &&other) noexcept
- : d(qExchange(other.d, nullptr)) {}
+ : d(std::exchange(other.d, nullptr)) {}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPen)
void swap(QPen &other) noexcept { qt_ptr_swap(d, other.d); }
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index c946287411..b0051b6067 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -34,7 +34,7 @@ public:
QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill);
QRegion(const QRegion &region);
QRegion(QRegion &&other) noexcept
- : d(qExchange(other.d, const_cast<QRegionData*>(&shared_empty))) {}
+ : d(std::exchange(other.d, const_cast<QRegionData*>(&shared_empty))) {}
QRegion(const QBitmap &bitmap);
~QRegion();
QRegion &operator=(const QRegion &);
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index c614e004f0..dbad0d95f9 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -277,8 +277,8 @@ public:
explicit Holder(void *p, qt_destroy_func_t d) : ptr(p), destroy_func(d) {}
~Holder() { if (ptr && destroy_func) destroy_func(ptr); }
Holder(Holder &&other) noexcept
- : ptr(qExchange(other.ptr, nullptr)),
- destroy_func(qExchange(other.destroy_func, nullptr))
+ : ptr(std::exchange(other.ptr, nullptr)),
+ destroy_func(std::exchange(other.destroy_func, nullptr))
{
}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Holder)