diff options
author | Kai Köhne <kai.koehne@qt.io> | 2023-09-13 13:07:23 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2024-04-17 14:31:55 +0000 |
commit | f86060693484270edc6567926cee31a1f7f71df6 (patch) | |
tree | dc0d31c47f0187b8a28e8f0dd05e28a3437b2236 | |
parent | 4991f0e86f10196c4a67bc3d1d721f245ae08128 (diff) |
Advise against using QT_BEGIN_NAMESPACE, QT_END_NAMESPACE,
QT_FORWARD_DECLARE_CLASS macros. There might still be cases
where it is needed - e.g. for overloading operators. But
most cases can be easily avoided by just including Qt headers,
uic generated headers already in the respective .h file.
Change-Id: Ide4a2a93dee90a1adba70904838491240657f502
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r-- | quip-0013-Examples.rst | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/quip-0013-Examples.rst b/quip-0013-Examples.rst index 8fb6e81..05e0857 100644 --- a/quip-0013-Examples.rst +++ b/quip-0013-Examples.rst @@ -3,7 +3,8 @@ Title: Qt Examples Author: Kai Köhne, Edward Welbourne Status: Active Type: Informational -Post-History: https://lists.qt-project.org/pipermail/development/2018-November/034338.html +Post-History: https://lists.qt-project.org/pipermail/development/2018-November/034338.html, +https://lists.qt-project.org/pipermail/development/2023-September/044467.html Created: 2022-10-11 Qt Examples @@ -105,6 +106,16 @@ of an example because the individual features are currently not part of the public API. Instead, the build system should skip examples that do not have required dependencies. +Namespaced Qt +~~~~~~~~~~~~~ + +Qt examples need to compile also with Qt versions configured with +a custom namespace (configure -qt-namespace). However, the macros that +enable forward declaring Qt types - QT_BEGIN_NAMESPACE, QT_END_NAMESPACE, +QT_FORWARD_DECLARE_CLASS - are internal macros that are not supposed +to be used in customer code. Avoid using these, even if this means you need +to include an otherwise optional Qt header file. + Application Settings ~~~~~~~~~~~~~~~~~~~~ @@ -132,3 +143,5 @@ References - `Writing Qt Examples`: https://wiki.qt.io/Writing_Qt_Examples - `Documentation Style for Examples`: https://wiki.qt.io/Documentation_Style_for_Examples + +- `Qt in Namespace`: https://wiki.qt.io/Qt_In_Namespace |