aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-07-13 13:47:58 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-07-15 09:23:47 +0200
commitcfb38538acbb600b828543a3d7892780b96a1f9a (patch)
tree91cc86152822f1c741f48e35b624e43930344b7a /src/qml
parent47bf186e0c5c14c47c0b090f52fd8c915b5ea85c (diff)
Add equality operators for QQmlError and QQmlRefPointer
We need those to declare QProperties. Change-Id: I49bf656607931e5d50f6a07cac92b7e176bb2b75 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/qml/ftw/qqmlrefcount_p.h1
-rw-r--r--src/qml/qml/qqmlerror.cpp11
-rw-r--r--src/qml/qml/qqmlerror.h1
3 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/qml/ftw/qqmlrefcount_p.h b/src/qml/qml/ftw/qqmlrefcount_p.h
index b4f8acad49..1d016107e6 100644
--- a/src/qml/qml/ftw/qqmlrefcount_p.h
+++ b/src/qml/qml/ftw/qqmlrefcount_p.h
@@ -102,6 +102,7 @@ public:
inline T* take() { T *res = o; o = nullptr; return res; }
+ friend bool operator==(const QQmlRefPointer &a, const QQmlRefPointer &b) { return a.o == b.o; }
private:
T *o;
};
diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp
index 706cc8601d..099dccd5d0 100644
--- a/src/qml/qml/qqmlerror.cpp
+++ b/src/qml/qml/qqmlerror.cpp
@@ -86,6 +86,12 @@ public:
QtMsgType type = QtWarningMsg;
int line = -1;
int column = -1;
+
+ friend bool operator==(const QQmlErrorPrivate &a, const QQmlErrorPrivate &b)
+ {
+ return a.url == b.url && a.object == b.object && a.message == b.message
+ && a.type == b.type && a.line == b.line && a.column == b.column;
+ }
};
/*!
@@ -298,6 +304,11 @@ QString QQmlError::toString() const
return rv;
}
+bool operator==(const QQmlError &a, const QQmlError &b)
+{
+ return a.d == b.d || (a.d && b.d && *a.d == *b.d);
+}
+
/*!
\relates QQmlError
\fn QDebug operator<<(QDebug debug, const QQmlError &error)
diff --git a/src/qml/qml/qqmlerror.h b/src/qml/qml/qqmlerror.h
index 8ea493c11d..449328fcd1 100644
--- a/src/qml/qml/qqmlerror.h
+++ b/src/qml/qml/qqmlerror.h
@@ -76,6 +76,7 @@ public:
void setMessageType(QtMsgType messageType);
QString toString() const;
+ friend bool Q_QML_EXPORT operator==(const QQmlError &a, const QQmlError &b);
private:
QQmlErrorPrivate *d;
};