Unify QLoggingCategory's two constructors

This follows upon commit ca0df4b2694fc3ca0c31cda0d5edec7e76f7dfcb's
comment requesting the unification. Tidied docs at the same time.

Task-number: QTBUG-85700
Change-Id: Ia12dbe98b94388030c7a06036c5287cfbcc4fd05
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
Edward Welbourne 2020-07-21 16:55:05 +02:00
parent 953cca326d
commit 07a5ab6c62
2 changed files with 5 additions and 20 deletions

View File

@ -196,28 +196,15 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
\snippet qloggingcategory/main.cpp 3
*/
/*!
Constructs a QLoggingCategory object with the provided \a category name.
All message types for this category are enabled by default.
If \a category is \c{0}, the category name is changed to \c "default".
\note \a category must be kept valid during the lifetime of this object.
*/
QLoggingCategory::QLoggingCategory(const char *category)
: d(nullptr),
name(nullptr)
{
init(category, QtDebugMsg);
}
/*!
Constructs a QLoggingCategory object with the provided \a category name,
and enables all messages with types more severe or equal than \a enableForLevel.
and enables all messages with types at least as verbose as \a enableForLevel,
which defaults to QtDebugMsg (which enables all categories).
If \a category is \c{0}, the category name is changed to \c "default".
If \a category is \nullptr, the category name \c "default" is used.
\note \a category must be kept valid during the lifetime of this object.
Using a string literal for it is the usual way to achieve this.
\since 5.4
*/

View File

@ -49,9 +49,7 @@ class Q_CORE_EXPORT QLoggingCategory
{
Q_DISABLE_COPY(QLoggingCategory)
public:
// ### Qt 6: Merge constructors
explicit QLoggingCategory(const char *category);
QLoggingCategory(const char *category, QtMsgType severityLevel);
explicit QLoggingCategory(const char *category, QtMsgType severityLevel = QtDebugMsg);
~QLoggingCategory();
bool isEnabled(QtMsgType type) const;