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>bb10
parent
49f9271360
commit
fdf7774bc6
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue