diff options
author | Kai Koehne <kai.koehne@digia.com> | 2014-01-10 15:42:19 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-14 08:45:00 +0100 |
commit | 85e576535c9c39756ecaddefa245f71fb35b8589 (patch) | |
tree | b5f9333825c3d1eb901cbddb67101a29d486202d /src/corelib/io | |
parent | b648f11227054b1e029c202c2a996f359335a86b (diff) |
Let Q_DECLARE_LOGGING_CATEGORY and Q_LOGGING_CATEGORY return a const reference
In general QLoggingCategory should be treated as a const object that's
configured by the backend. The only legitimate place where user code
should call setEnabled is in a CategoryFilter ...
[ChangeLog][QtCore][Logging] Make Q_LOGGING_CATEGORY
and Q_DECLARE_LOGGING_CATEGORY return a const object.
Change-Id: I6140442ab48286e05cd3b55064a502bbe6dfb16a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qloggingcategory.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h index 37735908a1..e701f93472 100644 --- a/src/corelib/io/qloggingcategory.h +++ b/src/corelib/io/qloggingcategory.h @@ -84,13 +84,13 @@ private: }; #define Q_DECLARE_LOGGING_CATEGORY(name) \ - extern QLoggingCategory &name(); + extern const QLoggingCategory &name(); // relies on QLoggingCategory(QString) being thread safe! #define Q_LOGGING_CATEGORY(name, string) \ - QLoggingCategory &name() \ + const QLoggingCategory &name() \ { \ - static QLoggingCategory category(string); \ + static const QLoggingCategory category(string); \ return category; \ } |