Skip to content

Commit

Permalink
Add QT_USE_NAMESPACE macro (#6864)
Browse files Browse the repository at this point in the history
The macro `QT_USE_NAMESPACE` should expand to nothing for most Qt
builds, i.e. built with an empty `QT_NAMESPACE` variable.

However if Qt is built using a custom namespace then all forward
declarations must be wrapped with `QT_BEGIN_NAMESPACE` and
`QT_END_NAMESPACE`. Today CppCheck defines these macros as empty, thus
`QT_USE_NAMESPACE` should be empty as well.

Reference:
https://wiki.qt.io/Qt_In_Namespace
  • Loading branch information
bjornblissing authored Oct 6, 2024
1 parent 62127a8 commit e8f6d1f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cfg/qt.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5368,6 +5368,7 @@
<define name="Q_RETURN_ARG(type, data)" value="QReturnArgument&lt;type &gt;(#type, data)"/>
<define name="Q_UNLIKELY(expr)" value="expr"/>
<define name="Q_UNUSED(X)" value="(void)(X);"/>
<define name="QT_USE_NAMESPACE" value=""/>
<define name="QT_BEGIN_NAMESPACE" value=""/>
<define name="QT_END_NAMESPACE" value=""/>
<define name="QT_BEGIN_MOC_NAMESPACE" value=""/>
Expand Down

0 comments on commit e8f6d1f

Please sign in to comment.