summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-12-01 14:43:53 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-12-01 18:43:26 +0000
commit35b2e74fd77d912cdd7efed379b648609a95d4b5 (patch)
treed067f4c52f3140522d87d725da9ced9c4b95ca5e /src/corelib/kernel
parent54c18ea30acd11cd8c10ca68b5d7bf9d589b2699 (diff)
Add a note about where to declare the streaming operators
Streaming operators for types used together with QMetaType should get declared in the same namespace as the type itself because of C++s ADL rules. Add a note about that to the documentation. Fixes: QTBUG-88990 Change-Id: I5d687576c6d926823dd0f1fec0743e877ae271af Reviewed-by: Robert Griebl <robert.griebl@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 5494f0af323a42390f9375c75e9298290ecb7662) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qmetatype.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 21fd2d2aed..7298dc588f 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -245,7 +245,8 @@ Q_GLOBAL_STATIC(QMetaTypeCustomRegistry, customTypeRegistry)
\note This method also registers the stream and debug operators for the type if they
are visible at registration time. As this is done automatically in some places,
it is strongly recommended to declare the stream operators for a type directly
- after the type itself.
+ after the type itself. Because of the argument dependent lookup rules of C++, it is
+ also strongly recommended to declare the operators in the same namespace as the type itself.
The stream operators should have the following signatures: