diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index bc280243e41..238b9cf4b4a 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -58,112 +58,50 @@ using namespace Qt::StringLiterals; \title Global Qt Declarations \ingroup funclists - \brief The header file includes the fundamental global - declarations. It is included by most other Qt header files. + \brief The header file includes an assortment of other headers. - The global declarations include \l{types}, \l{functions} and - \l{macros}. + Up to Qt 6.5, most Qt header files included . Before Qt 6.5, + defined an assortment of global declarations. Most of these + have moved, at Qt 6.5, to separate headers, so that source code can + include only what it needs, rather than the whole assortment. For now, + includes those other headers (see next section), but future + releases of Qt may remove some of these headers from or + condition their inclusion on a version check. Likewise, in future + releases, some Qt headers that currently include may stop + doing so. The hope is that this will improve compilation times by + avoiding global declarations when they are not used. - The type definitions are partly convenience definitions for basic - types (some of which guarantee certain bit-sizes on all platforms - supported by Qt), partly types related to Qt message handling. The - functions are related to generating messages, Qt version handling - and comparing and adjusting object values. And finally, some of - the declared macros enable programmers to add compiler or platform - specific code to their applications, while others are convenience - macros for larger operations. + \section1 List of Headers Extracted from - \section1 Types - - The header file declares several type definitions that guarantee a - specified bit-size on all platforms supported by Qt for various - basic types, for example \l qint8 which is a signed char - guaranteed to be 8-bit on all platforms supported by Qt. The - header file also declares the \l qlonglong type definition for \c - {long long int } (\c __int64 on Windows). - - Several convenience type definitions are declared: \l qreal for \c - double or \c float, \l uchar for \c unsigned char, \l uint for \c unsigned - int, \l ulong for \c unsigned long and \l ushort for \c unsigned - short. - - Finally, the QtMsgType definition identifies the various messages - that can be generated and sent to a Qt message handler; - QtMessageHandler is a type definition for a pointer to a function with - the signature - \c {void myMessageHandler(QtMsgType, const QMessageLogContext &, const char *)}. - QMessageLogContext class contains the line, file, and function the - message was logged at. This information is created by the QMessageLogger - class. - - \section1 Functions - - The header file contains several functions comparing - and adjusting an object's value. These functions take a template - type as argument: You can retrieve the absolute value of an object - using the qAbs() function, and you can bound a given object's - value by given minimum and maximum values using the qBound() - function. You can retrieve the minimum and maximum of two given - objects using qMin() and qMax() respectively. All these functions - return a corresponding template type; the template types can be - replaced by any other type. - - Example: - - \snippet code/src_corelib_global_qglobal.cpp 3 - - also contains functions that generate messages from the - given string argument: qDebug(), qInfo(), qWarning(), qCritical(), - and qFatal(). These functions call the message handler - with the given message. - - Example: - - \snippet code/src_corelib_global_qglobal.cpp 4 - - The remaining functions are qRound() and qRound64(), which both - accept a \c double or \c float value as their argument returning - the value rounded up to the nearest integer and 64-bit integer - respectively, the qInstallMessageHandler() function which installs - the given QtMessageHandler, and the qVersion() function which - returns the version number of Qt at runtime as a string. - - \section1 Macros - - The header file provides a range of macros (Q_CC_*) - that are defined if the application is compiled using the - specified platforms. For example, the Q_CC_SUN macro is defined if - the application is compiled using Forte Developer, or Sun Studio - C++. The header file also declares a range of macros (Q_OS_*) - that are defined for the specified platforms. For example, - Q_OS_UNIX which is defined for the Unix-based systems. - - The purpose of these macros is to enable programmers to add - compiler or platform specific code to their application. - - The remaining macros are convenience macros for larger operations: - The QT_TR_NOOP(), QT_TRANSLATE_NOOP(), and QT_TRANSLATE_NOOP3() - macros provide the possibility of marking strings for delayed - translation. QT_TR_N_NOOP(), QT_TRANSLATE_N_NOOP(), and - QT_TRANSLATE_N_NOOP3() are numerator dependent variants of these. - The Q_ASSERT() and Q_ASSERT_X() enables warning messages of various - level of refinement. The Q_FOREACH() and foreach() macros - implement Qt's foreach loop. - - The Q_INT64_C() and Q_UINT64_C() macros wrap signed and unsigned - 64-bit integer literals in a platform-independent way. The - Q_CHECK_PTR() macro prints a warning containing the source code's - file name and line number, saying that the program ran out of - memory, if the pointer is \nullptr. The qPrintable() and qUtf8Printable() - macros represent an easy way of printing text. - - The QT_POINTER_SIZE macro expands to the size of a pointer in bytes. - - The macros QT_VERSION and QT_VERSION_STR expand to a numeric value or a - string, respectively. These identify the version of Qt that the application - is compiled with. - - \sa , QSysInfo + \table + \header \li Header \li Summary + \row \li \li Type-safe way of combining enum values + \row \li \l \li Qt's implementation of foreach and forever loops + \row \li \l \li Typedef for a pointer-to-function type + \row \li \li Thread-safe initialization of global static objects + \row \li \l \li Helpers for resolving member function overloads + \row \li \li A helper class to get system information + \row \li \l \li Helpers to get type information + \row \li \l \li Q_ASSERT and other runtime checks + \row \li \l \li Qt class helper macros + \row \li \l \li Compiler-specific macro definitions + \row \li \l \li Deprecation helper macros + \row \li \l \li Helpers for working with environment variables + \row \li \li Helpers for exception handling + \row \li \l \li Qt logging helpers + \row \li \li Memory allocation helpers + \row \li \l \li Helpers for comparing values + \row \li \l \li Various numeric functions + \row \li \l \li Helper preprocessor macros + \row \li \l \li Architecture-specific macro definitions + \row \li \l \li Helpers for initializing and cleaning resources + \row \li \l \li Implementation of qSwap() + \row \li \l \li Platform-specific macro definitions + \row \li \l \li Qt translation helpers + \row \li \l \li Qt type traits + \row \li \l \li Qt fundamental type declarations + \row \li \l \li Qt Version related checks + \endtable */ /*