summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-09-28 08:25:27 +0200
committerIvan Solovev <ivan.solovev@qt.io>2023-09-30 13:02:05 +0200
commitfdf7774bc6c0f1dc86905cca564b3a1a02413281 (patch)
treee044277c6678f9a7f91cfd19544561227fb6e604 /src/corelib
parent49f9271360e0ef4e624212e442dfcd7765571d60 (diff)
QPersistentModelIndex: fix relational operators not being noexcept
They actually can be, so the implementation need not change. Just add the noexcept tag (which is BC, it's not part of the name mangling on any compiler). Silences a bunch of XFAIL in the test (the test is automatically picking up the change, no need, and no way, to manually remove the QEXPECT_FAIL). Change-Id: I24b6ba1248001056de64f341617943e7aea5ae93 Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp8
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h10
2 files changed, 9 insertions, 9 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index a042dceca0..0f67920d43 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -382,7 +382,7 @@ QPersistentModelIndex::~QPersistentModelIndex()
model index are used when comparing with another persistent model index.
*/
-bool QPersistentModelIndex::operator==(const QPersistentModelIndex &other) const
+bool QPersistentModelIndex::operator==(const QPersistentModelIndex &other) const noexcept
{
if (d && other.d)
return d->index == other.d->index;
@@ -399,7 +399,7 @@ bool QPersistentModelIndex::operator==(const QPersistentModelIndex &other) const
model index are used when comparing with another persistent model index.
*/
-bool QPersistentModelIndex::operator<(const QPersistentModelIndex &other) const
+bool QPersistentModelIndex::operator<(const QPersistentModelIndex &other) const noexcept
{
if (d && other.d)
return d->index < other.d->index;
@@ -477,7 +477,7 @@ QPersistentModelIndex::operator QModelIndex() const
model index are used when comparing with another model index.
*/
-bool QPersistentModelIndex::operator==(const QModelIndex &other) const
+bool QPersistentModelIndex::operator==(const QModelIndex &other) const noexcept
{
if (d)
return d->index == other;
@@ -491,7 +491,7 @@ bool QPersistentModelIndex::operator==(const QModelIndex &other) const
location as the \a other model index; otherwise returns \c{false}.
*/
-bool QPersistentModelIndex::operator!=(const QModelIndex &other) const
+bool QPersistentModelIndex::operator!=(const QModelIndex &other) const noexcept
{
if (d)
return d->index != other;
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index 86b3eb7627..8f22f14989 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -178,17 +178,17 @@ public:
QPersistentModelIndex(const QModelIndex &index);
QPersistentModelIndex(const QPersistentModelIndex &other);
~QPersistentModelIndex();
- bool operator<(const QPersistentModelIndex &other) const;
- bool operator==(const QPersistentModelIndex &other) const;
- inline bool operator!=(const QPersistentModelIndex &other) const
+ bool operator<(const QPersistentModelIndex &other) const noexcept;
+ bool operator==(const QPersistentModelIndex &other) const noexcept;
+ inline bool operator!=(const QPersistentModelIndex &other) const noexcept
{ return !operator==(other); }
QPersistentModelIndex &operator=(const QPersistentModelIndex &other);
inline QPersistentModelIndex(QPersistentModelIndex &&other) noexcept
: d(std::exchange(other.d, nullptr)) {}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPersistentModelIndex)
void swap(QPersistentModelIndex &other) noexcept { qt_ptr_swap(d, other.d); }
- bool operator==(const QModelIndex &other) const;
- bool operator!=(const QModelIndex &other) const;
+ bool operator==(const QModelIndex &other) const noexcept;
+ bool operator!=(const QModelIndex &other) const noexcept;
QPersistentModelIndex &operator=(const QModelIndex &other);
operator QModelIndex() const;
int row() const;