summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-07-08 16:58:11 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-07-12 21:25:29 +0000
commitc80622cfd8336d3f17599d73a0214174e1ba1664 (patch)
treeffc5ecfea0f6c2d65f26dcee7810bdebdfab272c /src/render
parent34386672a58799d5ea7f1d9e6aa4b3896824b7f4 (diff)
FilterKey: fix ambiguous relational operators in C++20
The member operators weren't const, leading them to be ambiguous with their reversed versions. Fix by adding a private equals() function (to avoid churning the implementation) and making the relational operators hidden friends. Task-number: QTBUG-104172 Change-Id: I97e74ef26fc2712d6f97c8f7d7bd61d6a625b42e Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit bcd20a74c9f2cd5920ecc5c1c0bb6d577db6cb50) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/render')
-rw-r--r--src/render/materialsystem/filterkey.cpp7
-rw-r--r--src/render/materialsystem/filterkey_p.h9
2 files changed, 8 insertions, 8 deletions
diff --git a/src/render/materialsystem/filterkey.cpp b/src/render/materialsystem/filterkey.cpp
index eb662b409..4a4d309f6 100644
--- a/src/render/materialsystem/filterkey.cpp
+++ b/src/render/materialsystem/filterkey.cpp
@@ -83,7 +83,7 @@ void FilterKey::syncFromFrontEnd(const QNode *frontEnd, bool firstTime)
}
}
-bool FilterKey::operator ==(const FilterKey &other)
+bool FilterKey::equals(const FilterKey &other) const
{
if (&other == this)
return true;
@@ -97,11 +97,6 @@ bool FilterKey::operator ==(const FilterKey &other)
other.value() == value());
}
-bool FilterKey::operator !=(const FilterKey &other)
-{
- return !operator ==(other);
-}
-
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/materialsystem/filterkey_p.h b/src/render/materialsystem/filterkey_p.h
index fc9a0909d..a4d147a5d 100644
--- a/src/render/materialsystem/filterkey_p.h
+++ b/src/render/materialsystem/filterkey_p.h
@@ -72,10 +72,15 @@ public:
const QVariant &value() const { return m_value; }
const QString &name() const { return m_name; }
void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override;
- bool operator ==(const FilterKey &other);
- bool operator !=(const FilterKey &other);
+
+ friend bool operator==(const FilterKey &lhs, const FilterKey &rhs)
+ { return lhs.equals(rhs); }
+ friend bool operator !=(const FilterKey &lhs, const FilterKey &rhs)
+ { return !lhs.equals(rhs); }
private:
+ bool equals(const FilterKey &other) const;
+
QVariant m_value;
QString m_name;
};