Add convenience enum for QDebug's verbosity levels
Change-Id: I9b7ad39c64d4b5787ce59db91b9ddadb82646e31 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
0d65c71a19
commit
a1ad9b590b
@ -356,7 +356,7 @@ QDebug &QDebug::resetFormat()
|
||||
stream->space = true;
|
||||
if (stream->context.version > 1)
|
||||
stream->flags = 0;
|
||||
stream->setVerbosity(Stream::DefaultVerbosity);
|
||||
stream->setVerbosity(DefaultVerbosity);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -461,7 +461,7 @@ QDebug &QDebug::resetFormat()
|
||||
|
||||
The allowed range is from 0 to 7. The default value is 2.
|
||||
|
||||
\sa setVerbosity()
|
||||
\sa setVerbosity(), VerbosityLevel
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -472,7 +472,7 @@ QDebug &QDebug::resetFormat()
|
||||
|
||||
The allowed range is from 0 to 7. The default value is 2.
|
||||
|
||||
\sa verbosity()
|
||||
\sa verbosity(), VerbosityLevel
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -483,6 +483,19 @@ QDebug &QDebug::resetFormat()
|
||||
|
||||
The allowed range is from 0 to 7. The default value is 2.
|
||||
|
||||
\sa verbosity(), setVerbosity(), VerbosityLevel
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QDebug::VerbosityLevel
|
||||
\since 5.13
|
||||
|
||||
This enum describes the range of verbosity levels.
|
||||
|
||||
\value MinimumVerbosity
|
||||
\value DefaultVerbosity
|
||||
\value MaximumVerbosity
|
||||
|
||||
\sa verbosity(), setVerbosity()
|
||||
*/
|
||||
|
||||
|
@ -67,7 +67,7 @@ class Q_CORE_EXPORT QDebug
|
||||
friend class QMessageLogger;
|
||||
friend class QDebugStateSaverPrivate;
|
||||
struct Stream {
|
||||
enum { DefaultVerbosity = 2, VerbosityShift = 29, VerbosityMask = 0x7 };
|
||||
enum { VerbosityShift = 29, VerbosityMask = 0x7 };
|
||||
|
||||
Stream(QIODevice *device) : ts(device), ref(1), type(QtDebugMsg),
|
||||
space(true), message_output(false), flags(DefaultVerbosity << VerbosityShift) {}
|
||||
@ -92,7 +92,7 @@ class Q_CORE_EXPORT QDebug
|
||||
void setFlag(FormatFlag flag) { if (context.version > 1) { flags |= flag; } }
|
||||
void unsetFlag(FormatFlag flag) { if (context.version > 1) { flags &= ~flag; } }
|
||||
int verbosity() const
|
||||
{ return context.version > 1 ? (flags >> VerbosityShift) & VerbosityMask : int(Stream::DefaultVerbosity); }
|
||||
{ return context.version > 1 ? (flags >> VerbosityShift) & VerbosityMask : int(DefaultVerbosity); }
|
||||
void setVerbosity(int v)
|
||||
{
|
||||
if (context.version > 1) {
|
||||
@ -126,6 +126,7 @@ public:
|
||||
inline QDebug &verbosity(int verbosityLevel) { setVerbosity(verbosityLevel); return *this; }
|
||||
int verbosity() const { return stream->verbosity(); }
|
||||
void setVerbosity(int verbosityLevel) { stream->setVerbosity(verbosityLevel); }
|
||||
enum VerbosityLevel { MinimumVerbosity = 0, DefaultVerbosity = 2, MaximumVerbosity = 7 };
|
||||
|
||||
bool autoInsertSpaces() const { return stream->space; }
|
||||
void setAutoInsertSpaces(bool b) { stream->space = b; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user