- Qt 6.9
- Qt Core
- QDebug Proxy Page
- Qt 6.9.2 Reference Documentation

# QDebug Proxy Page

## Functions

QDebug | operator<<(QDebug debug, const QContiguousCache<T> &cache)
QDebug | operator<<(QDebug debug, const QFlags<T> &flags)
QDebug | operator<<(QDebug debug, const QHash<Key, T> &hash)
QDebug | operator<<(QDebug debug, const QList<T> &list)
QDebug | operator<<(QDebug debug, const QMap<Key, T> &map)
QDebug | operator<<(QDebug debug, const QMultiHash<Key, T> &hash)
QDebug | operator<<(QDebug debug, const QMultiMap<Key, T> &map)
QDebug | operator<<(QDebug debug, const QSet<T> &set)
`(since 6.3)` QDebug | operator<<(QDebug debug, const QVarLengthArray<T, P> &array)
`(since 6.9)` QDebug | operator<<(QDebug debug, const std::array<T, N> &array)
QDebug | operator<<(QDebug debug, const std::list<T, Alloc> &vec)
QDebug | operator<<(QDebug debug, const std::map<Key, T, Compare, Alloc> &map)
QDebug | operator<<(QDebug debug, const std::multimap<Key, T, Compare, Alloc> &map)
`(since 6.9)` QDebug | operator<<(QDebug debug, const std::multiset<Key, Compare, Alloc> &multiset)
QDebug | operator<<(QDebug debug, const std::pair<T1, T2> &pair)
`(since 6.9)` QDebug | operator<<(QDebug debug, const std::set<Key, Compare, Alloc> &set)
`(since 6.9)` QDebug | operator<<(QDebug debug, const std::unordered_map<Key, T, Hash, KeyEqual, Alloc> &map)
`(since 6.9)` QDebug | operator<<(QDebug debug, const std::unordered_set<Key, Hash, KeyEqual, Alloc> &unordered_set)
QDebug | operator<<(QDebug debug, const std::vector<T, Alloc> &vec)

## Macros

QDebug | qCritical
QDebug | qDebug
QDebug | qFatal
QDebug | qInfo
QDebug | qWarning

## Function Documentation

### template <typename T> QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)

Writes the contents of cache to debug. `T` needs to support streaming into QDebug.

### template <typename T> QDebug operator<<(QDebug debug, const QFlags<T> &flags)

Writes flags to debug.

### template <typename Key, typename T> QDebug operator<<(QDebug debug, const QHash<Key, T> &hash)

Writes the contents of hash to debug. Both `Key` and `T` need to support streaming into QDebug.

### template <typename T> QDebug operator<<(QDebug debug, const QList<T> &list)

Writes the contents of list to debug. `T` needs to support streaming into QDebug.

### template <typename Key, typename T> QDebug operator<<(QDebug debug, const QMap<Key, T> &map)

Writes the contents of map to debug. Both `Key` and `T` need to support streaming into QDebug.

### template <typename Key, typename T> QDebug operator<<(QDebug debug, const QMultiHash<Key, T> &hash)

Writes the contents of hash to debug. Both `Key` and `T` need to support streaming into QDebug.

### template <typename Key, typename T> QDebug operator<<(QDebug debug, const QMultiMap<Key, T> &map)

Writes the contents of map to debug. Both `Key` and `T` need to support streaming into QDebug.

### template <typename T> QDebug operator<<(QDebug debug, const QSet<T> &set)

Writes the contents of set to debug. `T` needs to support streaming into QDebug.

### `[since 6.3]` template <typename T, qsizetype P> QDebug operator<<(QDebug debug, const QVarLengthArray<T, P> &array)

Writes the contents of array to debug. `T` needs to support streaming into QDebug.

This function was introduced in Qt 6.3.

### `[since 6.9]` template <typename T, std::size_t N> QDebug operator<<(QDebug debug, const std::array<T, N> &array)

Writes the contents of array to debug. `T` needs to support streaming into QDebug.

This function was introduced in Qt 6.9.

### template <typename T, typename Alloc> QDebug operator<<(QDebug debug, const std::list<T, Alloc> &vec)

Writes the contents of list vec to debug. `T` needs to support streaming into QDebug.

### template <typename Key, typename T, typename Compare, typename Alloc> QDebug operator<<(QDebug debug, const std::map<Key, T, Compare, Alloc> &map)

Writes the contents of map to debug. Both `Key` and `T` need to support streaming into QDebug.

### template <typename Key, typename T, typename Compare, typename Alloc> QDebug operator<<(QDebug debug, const std::multimap<Key, T, Compare, Alloc> &map)

Writes the contents of map to debug. Both `Key` and `T` need to support streaming into QDebug.

### `[since 6.9]` template <typename Key, typename Compare, typename Alloc> QDebug operator<<(QDebug debug, const std::multiset<Key, Compare, Alloc> &multiset)

Writes the contents of multiset to debug. The `Key` type needs to support streaming into QDebug.

This function was introduced in Qt 6.9.

### template <typename T1, typename T2> QDebug operator<<(QDebug debug, const std::pair<T1, T2> &pair)

Writes the contents of pair to debug. Both `T1` and `T2` need to support streaming into QDebug.

### `[since 6.9]` template <typename Key, typename Compare, typename Alloc> QDebug operator<<(QDebug debug, const std::set<Key, Compare, Alloc> &set)

Writes the contents of set to debug. The `Key` type needs to support streaming into QDebug.

This function was introduced in Qt 6.9.

### `[since 6.9]` template <typename Key, typename T, typename Hash, typename KeyEqual, typename Alloc> QDebug operator<<(QDebug debug, const std::unordered_map<Key, T, Hash, KeyEqual, Alloc> &map)

Writes the contents of map to debug. Both `Key` and `T` need to support streaming into QDebug.

This function was introduced in Qt 6.9.

### `[since 6.9]` template <typename Key, typename Hash, typename KeyEqual, typename Alloc> QDebug operator<<(QDebug debug, const std::unordered_set<Key, Hash, KeyEqual, Alloc> &unordered_set)

Writes the contents of unordered_set to debug. The `Key` type needs to support streaming into QDebug.

This function was introduced in Qt 6.9.

### template <typename T, typename Alloc> QDebug operator<<(QDebug debug, const std::vector<T, Alloc> &vec)

Writes the contents of vector vec to debug. `T` needs to support streaming into QDebug.

## Macro Documentation

### QDebug qCritical

Returns a QDebug object that logs a critical message to the central message handler.

Example:

     qCritical() << "Brush:" << myQBrush << "Other value:" << i;

Using qCritical() is an alternative to qCritical(const char *, ...), which follows the printf paradigm.

Note that QDebug and the type specific stream operators do add various formatting to make the debug message easier to read. See the formatting options documentation for more details.

For debugging purposes, it is sometimes convenient to let the program abort for critical messages. This allows you then to inspect the core dump, or attach a debugger - see also qFatal(). To enable this, set the environment variable `QT_FATAL_CRITICALS` to a number `n`. The program terminates then for the n-th critical message. That is, if the environment variable is set to 1, it will terminate on the first call; if it contains the value 10, it will exit on the 10th call. Any non-numeric value in the environment variable is equivalent to 1.

Note: This macro is thread-safe.

See also qCritical(const char *, ...) and qCCritical().

### QDebug qDebug

Returns a QDebug object that logs a debug message to the central message handler.

Example:

     qDebug() << "Brush:" << myQBrush << "Other value:" << i;

Using qDebug() is an alternative to qDebug(const char *, ...), which follows the printf paradigm.

Note that QDebug and the type specific stream operators do add various formatting to make the debug message easier to read. See the formatting options documentation for more details.

This function does nothing if `QT_NO_DEBUG_OUTPUT` was defined during compilation.

Note: This macro is thread-safe.

See also qDebug(const char *, ...) and qCDebug().

### QDebug qFatal

Returns a QDebug object that logs a fatal message to the central message handler.

Using qFatal() is an alternative to qFatal(const char *, ...), which follows the printf paradigm.

Note that QDebug and the type specific stream operators do add various formatting to make the debug message easier to read. See the formatting options documentation for more details.

If you are using the default message handler, the returned stream will abort to create a core dump. On Windows, for debug builds, this function will report a _CRT_ERROR enabling you to connect a debugger to the application.

Note: This macro is thread-safe.

See also qFatal(const char *, ...) and qCFatal().

### QDebug qInfo

Returns a QDebug object that logs an informational message to the central message handler.

Example:

     qInfo() << "Brush:" << myQBrush << "Other value:" << i;

Using qInfo() is an alternative to qInfo(const char *, ...), which follows the printf paradigm.

Note that QDebug and the type specific stream operators do add various formatting to make the debug message easier to read. See the formatting options documentation for more details.

This function does nothing if `QT_NO_INFO_OUTPUT` was defined during compilation.

Note: This macro is thread-safe.

See also qInfo(const char *, ...) and qCInfo().

### QDebug qWarning

Returns a QDebug object that logs a warning message to the central message handler.

Example:

     qWarning() << "Brush:" << myQBrush << "Other value:" << i;

Using qWarning() is an alternative to qWarning(const char *, ...), which follows the printf paradigm.

Note that QDebug and the type specific stream operators do add various formatting to make the debug message easier to read. See the formatting options documentation for more details.

This function does nothing if `QT_NO_WARNING_OUTPUT` was defined during compilation.

For debugging purposes, it is sometimes convenient to let the program abort for warning messages. This allows you then to inspect the core dump, or attach a debugger - see also qFatal(). To enable this, set the environment variable `QT_FATAL_WARNINGS` to a number `n`. The program terminates then for the n-th warning. That is, if the environment variable is set to 1, it will terminate on the first call; if it contains the value 10, it will exit on the 10th call. Any non-numeric value in the environment variable is equivalent to 1.

Note: This macro is thread-safe.

See also qWarning(const char *, ...) and qCWarning().