Qisinf qt creator что это
Qt Documentation
Contents
The header file includes the fundamental global declarations. It is included by most other Qt header files. More.
Types
typedef | QFunctionPointer |
typedef | QtMessageHandler |
enum | QtMsgType |
typedef | qint8 |
typedef | qint16 |
typedef | qint32 |
typedef | qint64 |
typedef | qintptr |
typedef | qlonglong |
typedef | qptrdiff |
typedef | qreal |
typedef | quint8 |
typedef | quint16 |
typedef | quint32 |
typedef | quint64 |
typedef | quintptr |
typedef | qulonglong |
typedef | uchar |
typedef | uint |
typedef | ulong |
typedef | ushort |
Functions
Macros
QT_DISABLE_DEPRECATED_BEFORE | |
QT_POINTER_SIZE | |
QT_REQUIRE_VERSION(int argc, char **argv, const char *version) | |
QT_TRANSLATE_NOOP3(context, sourceText, comment) | |
QT_TRANSLATE_NOOP(context, sourceText) | |
QT_TRID_NOOP(id) | |
QT_TR_NOOP(sourceText) | |
QT_VERSION | |
QT_VERSION_CHECK | |
QT_VERSION_STR | |
void | Q_ASSERT(bool test) |
void | Q_ASSERT_X(bool test, const char *where, const char *what) |
void | Q_ASSUME(bool expr) |
Q_BIG_ENDIAN | |
Q_BYTE_ORDER | |
Q_CC_BOR | |
Q_CC_CDS | |
Q_CC_COMEAU | |
Q_CC_DEC | |
Q_CC_EDG | |
Q_CC_GHS | |
Q_CC_GNU | |
Q_CC_HIGHC | |
Q_CC_HPACC | |
Q_CC_INTEL | |
Q_CC_KAI | |
Q_CC_MIPS | |
Q_CC_MSVC | |
Q_CC_OC | |
Q_CC_PGI | |
Q_CC_SUN | |
Q_CC_SYM | |
Q_CC_USLC | |
Q_CC_WAT | |
void | Q_CHECK_PTR(void *pointer) |
Q_DECLARE_TYPEINFO(Type, Flags) | |
Q_DECL_CONSTEXPR | |
Q_DECL_EXPORT | |
Q_DECL_FINAL | |
Q_DECL_IMPORT | |
Q_DECL_NOEXCEPT | |
Q_DECL_NOEXCEPT_EXPR(x) | |
Q_DECL_NOTHROW | |
Q_DECL_OVERRIDE | |
Q_DECL_RELAXED_CONSTEXPR | |
Q_FOREACH(variable, container) | |
Q_FOREVER | |
Q_FORWARD_DECLARE_CF_TYPE(type) | |
Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) | |
Q_FORWARD_DECLARE_OBJC_CLASS(classname) | |
const char * | Q_FUNC_INFO() |
qint64 | Q_INT64_C(literal) |
Q_LIKELY(expr) | |
Q_LITTLE_ENDIAN | |
Q_OS_AIX | |
Q_OS_ANDROID | |
Q_OS_BSD4 | |
Q_OS_BSDI | |
Q_OS_CYGWIN | |
Q_OS_DARWIN | |
Q_OS_DGUX | |
Q_OS_DYNIX | |
Q_OS_FREEBSD | |
Q_OS_HPUX | |
Q_OS_HURD | |
Q_OS_IOS | |
Q_OS_IRIX | |
Q_OS_LINUX | |
Q_OS_LYNX | |
Q_OS_MAC | |
Q_OS_MACOS | |
Q_OS_NETBSD | |
Q_OS_OPENBSD | |
Q_OS_OSF | |
Q_OS_OSX | |
Q_OS_QNX | |
Q_OS_RELIANT | |
Q_OS_SCO | |
Q_OS_SOLARIS | |
Q_OS_TVOS | |
Q_OS_ULTRIX | |
Q_OS_UNIX | |
Q_OS_UNIXWARE | |
Q_OS_WATCHOS | |
Q_OS_WIN32 | |
Q_OS_WIN64 | |
Q_OS_WIN | |
Q_OS_WINPHONE | |
Q_OS_WINRT | |
Q_PROCESSOR_X86 | |
Q_PROCESSOR_S390 | |
Q_PROCESSOR_ALPHA | |
Q_PROCESSOR_ARM | |
Q_PROCESSOR_ARM_V5 | |
Q_PROCESSOR_ARM_V6 | |
Q_PROCESSOR_ARM_V7 | |
Q_PROCESSOR_AVR32 | |
Q_PROCESSOR_BLACKFIN | |
Q_PROCESSOR_IA64 | |
Q_PROCESSOR_MIPS | |
Q_PROCESSOR_MIPS_32 | |
Q_PROCESSOR_MIPS_64 | |
Q_PROCESSOR_MIPS_I | |
Q_PROCESSOR_MIPS_II | |
Q_PROCESSOR_MIPS_III | |
Q_PROCESSOR_MIPS_IV | |
Q_PROCESSOR_MIPS_V | |
Q_PROCESSOR_POWER | |
Q_PROCESSOR_POWER_32 | |
Q_PROCESSOR_POWER_64 | |
Q_PROCESSOR_S390_X | |
Q_PROCESSOR_SH | |
Q_PROCESSOR_SH_4A | |
Q_PROCESSOR_SPARC | |
Q_PROCESSOR_SPARC_V9 | |
Q_PROCESSOR_X86_32 | |
Q_PROCESSOR_X86_64 | |
quint64 | Q_UINT64_C(literal) |
Q_UNLIKELY(expr) | |
void | Q_UNREACHABLE() |
Q_UNUSED(name) | |
foreach(variable, container) | |
forever | |
qCritical(const char *message, . ) | |
qDebug(const char *message, . ) | |
qFatal(const char *message, . ) | |
qInfo(const char *message, . ) | |
qMove(x) | |
const char * | qPrintable(const QString &str) |
const wchar_t * | qUtf16Printable(const QString &str) |
const char * | qUtf8Printable(const QString &str) |
qWarning(const char *message, . ) |
The global declarations include types, functions and macros.
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.
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 qint8 which is a signed char guaranteed to be 8-bit on all platforms supported by Qt. The header file also declares the qlonglong type definition for long long int ( __int64 on Windows).
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.
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.
The remaining functions are qRound() and qRound64(), which both accept a qreal 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 run-time as a string.
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_TRANSLATE_NOOP() and QT_TR_NOOP() macros provide the possibility of marking text for dynamic translation, i.e. translation without changing the stored source text. 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 0. The qPrintable() and qUtf8Printable() macros represent an easy way of printing text.
Finally, the QT_POINTER_SIZE macro expands to the size of a pointer in bytes, and the QT_VERSION and QT_VERSION_STR macros expand to a numeric value or a string, respectively, specifying Qt’s version number, i.e the version the application is compiled against.
Type Documentation
typedef QFunctionPointer
typedef QtMessageHandler
This is a typedef for a pointer to a function with the following signature:
This typedef was introduced in Qt 5.0.
enum QtMsgType
This enum describes the messages that can be sent to a message handler (QtMessageHandler). You can use the enum to identify and associate the various message types with the appropriate actions.
Constant | Value | Description |
---|---|---|
QtDebugMsg | 0 | A message generated by the qDebug() function. |
QtInfoMsg | 4 | A message generated by the qInfo() function. |
QtWarningMsg | 1 | A message generated by the qWarning() function. |
QtCriticalMsg | 2 | A message generated by the qCritical() function. |
QtFatalMsg | 3 | A message generated by the qFatal() function. |
QtSystemMsg | QtCriticalMsg | В |
QtInfoMsg was added in Qt 5.5.
typedef qint8
typedef qint16
typedef qint32
typedef qint64
Typedef for long long int ( __int64 on Windows). This type is guaranteed to be 64-bit on all platforms supported by Qt.
Literals of this type can be created using the Q_INT64_C() macro:
typedef qintptr
Integral type for representing pointers in a signed integer (useful for hashing, etc.).
Typedef for either qint32 or qint64. This type is guaranteed to be the same size as a pointer on all platforms supported by Qt. On a system with 32-bit pointers, qintptr is a typedef for qint32; on a system with 64-bit pointers, qintptr is a typedef for qint64.
Note that qintptr is signed. Use quintptr for unsigned values.
typedef qlonglong
Typedef for long long int ( __int64 on Windows). This is the same as qint64.
typedef qptrdiff
Integral type for representing pointer differences.
Typedef for either qint32 or qint64. This type is guaranteed to be the same size as a pointer on all platforms supported by Qt. On a system with 32-bit pointers, quintptr is a typedef for quint32; on a system with 64-bit pointers, quintptr is a typedef for quint64.
Note that qptrdiff is signed. Use quintptr for unsigned values.
typedef qreal
typedef quint8
typedef quint16
typedef quint32
typedef quint64
Typedef for unsigned long long int ( unsigned __int64 on Windows). This type is guaranteed to be 64-bit on all platforms supported by Qt.
Literals of this type can be created using the Q_UINT64_C() macro:
typedef quintptr
Integral type for representing pointers in an unsigned integer (useful for hashing, etc.).
Typedef for either quint32 or quint64. This type is guaranteed to be the same size as a pointer on all platforms supported by Qt. On a system with 32-bit pointers, quintptr is a typedef for quint32; on a system with 64-bit pointers, quintptr is a typedef for quint64.
Note that quintptr is unsigned. Use qptrdiff for signed values.
typedef qulonglong
Typedef for unsigned long long int ( unsigned __int64 on Windows). This is the same as quint64.
typedef uchar
typedef uint
typedef ulong
typedef ushort
Function Documentation
T qAbs (const T &value)
Compares value to the 0 of type T and returns the absolute value. Thus if T is double, then value is compared to (double) 0.
QtPrivate::QAddConst T > ::Type & qAsConst ( T &t)
This function is a Qt implementation of C++17’s std::as_const(), a cast function like std::move(). But while std::move() turns lvalues into rvalues, this function turns non-const lvalues into const lvalues. Like std::as_const(), it doesn’t work on rvalues, because it cannot be efficiently implemented for rvalues without leaving dangling references.
Its main use in Qt is to prevent implicitly-shared Qt containers from detaching:
Of course, in this case, you could (and probably should) have declared s as const in the first place:
but often that is not easily possible.
To prevent this construct from compiling (and failing at runtime), qAsConst() has a second, deleted, overload which binds to rvalues.
This function was introduced in Qt 5.7.
const T & qBound (const T &min, const T &value, const T &max)
Returns value bounded by min and max. This is equivalent to qMax(min, qMin(value, max)).
auto qConstOverload ( T memberFunctionPointer)
Returns the memberFunctionPointer pointer to a constant member function:
This function was introduced in Qt 5.7.
int qEnvironmentVariableIntValue (const char *varName, bool *ok = Q_NULLPTR)
Returns the numerical value of the environment variable varName. If ok is not null, sets *ok to true or false depending on the success of the conversion.
except that it’s much faster, and can’t throw exceptions.
This function was introduced in Qt 5.5.
bool qEnvironmentVariableIsEmpty (const char *varName)
Returns whether the environment variable varName is empty.
except that it’s potentially much faster, and can’t throw exceptions.
This function was introduced in Qt 5.1.
bool qEnvironmentVariableIsSet (const char *varName)
Returns whether the environment variable varName is set.
except that it’s potentially much faster, and can’t throw exceptions.
This function was introduced in Qt 5.1.
quint32 qFloatDistance ( float a, float b)
Returns the number of representable floating-point numbers between a and b.
This function provides an alternative way of doing approximated comparisons of floating-point numbers similar to qFuzzyCompare(). However, it returns the distance between two numbers, which gives the caller a possibility to choose the accepted error. Errors are relative, so for instance the distance between 1.0E-5 and 1.00001E-5 will give 110, while the distance between 1.0E36 and 1.00001E36 will give 127.
The return value can be considered as the «error», so if you for instance want to compare two 32-bit floating point numbers and all you need is an approximated 24-bit precision, you can use this function like this:
This function was introduced in Qt 5.2.
quint64 qFloatDistance ( double a, double b)
Returns the number of representable floating-point numbers between a and b.
This function was introduced in Qt 5.2.
QString qFormatLogMessage ( QtMsgType type, const QMessageLogContext &context, const QString &str)
Generates a formatted string out of the type, context, str arguments.
qFormatLogMessage returns a QString that is formatted according to the current message pattern. It can be used by custom message handlers to format output similar to Qt’s default message handler.
The function is thread-safe.
This function was introduced in Qt 5.4.
[static] bool qFuzzyCompare ( double p1, double p2)
Note that comparing values where either p1 or p2 is 0.0 will not work. The solution to this is to compare against values greater than or equal to 1.0.
The two numbers are compared in a relative way, where the exactness is stronger the smaller the numbers are.
This function was introduced in Qt 4.4.
[static] bool qFuzzyCompare ( float p1, float p2)
The two numbers are compared in a relative way, where the exactness is stronger the smaller the numbers are.
This function was introduced in Qt 4.4.
double qInf ()
Returns the bit pattern for an infinite number as a double.
QtMessageHandler qInstallMessageHandler ( QtMessageHandler handler)
Installs a Qt message handler which has been defined previously. Returns a pointer to the previous message handler.
The message handler is a function that prints out debug messages, warnings, critical and fatal error messages. The Qt library (debug mode) contains hundreds of warning messages that are printed when internal errors (usually invalid function arguments) occur. Qt built in release mode also contains such warnings unless QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during compilation. If you implement your own message handler, you get total control of these messages.
The default message handler prints the message to the standard output under X11 or to the debugger under Windows. If it is a fatal message, the application aborts immediately.
Only one message handler can be defined, since this is usually done on an application-wide basis to control debug output.
This function was introduced in Qt 5.0.
bool qIsFinite ( double d)
Returns true if the double d is a finite number.
bool qIsFinite ( float f)
Returns true if the float f is a finite number.
bool qIsInf ( double d)
Returns true if the double d is equivalent to infinity.
bool qIsInf ( float f)
Returns true if the float f is equivalent to infinity.
bool qIsNaN ( double d)
Returns true if the double d is not a number (NaN).
bool qIsNaN ( float f)
Returns true if the float f is not a number (NaN).
const T & qMax (const T &value1, const T &value2)
Returns the maximum of value1 and value2.
const T & qMin (const T &value1, const T &value2)
Returns the minimum of value1 and value2.
auto qNonConstOverload ( T memberFunctionPointer)
Returns the memberFunctionPointer pointer to a non-constant member function:
This function was introduced in Qt 5.7.
See also qOverload and qNonConstOverload.
auto qOverload ( T functionPointer)
Returns a pointer to an overloaded function. The template parameter is the list of the argument types of the function. functionPointer is the pointer to the (member) function:
If a member function is also const-overloaded qConstOverload and qNonConstOverload need to be used.
qOverload() requires C++14 enabled. In C++11-only code, the helper classes QOverload, QConstOverload, and QNonConstOverload can be used directly:
This function was introduced in Qt 5.7.
double qQNaN ()
Returns the bit pattern of a quiet NaN as a double.
qint64 qRound64 ( qreal value)
Rounds value to the nearest 64-bit integer.
int qRound ( qreal value)
Rounds value to the nearest integer.
double qSNaN ()
Returns the bit pattern of a signalling NaN as a double.
void qSetMessagePattern (const QString &pattern)
Changes the output of the default message handler.
Allows to tweak the output of qDebug(), qInfo(), qWarning(), qCritical(), and qFatal(). The category logging output of qCDebug(), qCInfo(), qCWarning(), and qCCritical() is formatted, too.
Following placeholders are supported:
You can also use conditionals on the type of the message using %
Finally, text inside %
The pattern can also be changed at runtime by setting the QT_MESSAGE_PATTERN environment variable; if both qSetMessagePattern() is called and QT_MESSAGE_PATTERN is set, the environment variable takes precedence.
Custom message handlers can use qFormatLogMessage() to take pattern into account.
This function was introduced in Qt 5.0.
const char * qVersion ()
Returns the version number of Qt at run-time as a string (for example, «4.1.2»). This may be a different version than the version the application was compiled against.
T * q_check_ptr ( T *pointer)
Uses Q_CHECK_PTR on pointer, then returns pointer.
This can be used as an inline version of Q_CHECK_PTR.
QByteArray qgetenv (const char *varName)
Returns the value of the environment variable with name varName. To get the variable string, use QByteArray::constData().
Note: qgetenv() was introduced because getenv() from the standard C library was deprecated in VC2005 (and later versions). qgetenv() uses the new replacement function in VC, and calls the standard C library’s implementation on all other platforms.
bool qputenv (const char *varName, const QByteArray &value)
This function sets the value of the environment variable named varName. It will create the variable if it does not exist. It returns 0 if the variable could not be set.
Calling qputenv with an empty value removes the environment variable on Windows, and makes it set (but empty) on Unix. Prefer using qunsetenv() for fully portable behavior.
Note: qputenv() was introduced because putenv() from the standard C library was deprecated in VC2005 (and later versions). qputenv() uses the replacement function in VC, and calls the standard C library’s implementation on all other platforms.
int qrand ()
Thread-safe version of the standard C++ rand() function.
Returns a value between 0 and RAND_MAX (defined in and ), the next number in the current sequence of pseudo-random integers.
Use qsrand() to initialize the pseudo-random number generator with a seed value.
This function was introduced in Qt 4.2.
void qsrand ( uint seed)
Thread-safe version of the standard C++ srand() function.
Sets the argument seed to be used to generate a new random number sequence of pseudo random integers to be returned by qrand().
The sequence of random numbers generated is deterministic per thread. For example, if two threads call qsrand(1) and subsequently call qrand(), the threads will get the same random number sequence.
This function was introduced in Qt 4.2.
The qtTrId function finds and returns a translated string.
Returns a translated string identified by id. If no matching string is found, the id itself is returned. This should not happen under normal conditions.
If n >= 0, all occurrences of %n in the resulting string are replaced with a decimal representation of n. In addition, depending on n‘s value, the translation text may vary.
Meta data and comments can be passed as documented for QObject::tr(). In addition, it is possible to supply a source string template like that:
Warning: This method is reentrant only if all translators are installed before calling this method. Installing or removing translators while performing translations is not supported. Doing so will probably result in crashes or other undesirable behavior.
Note: This function is reentrant
This function was introduced in Qt 4.6.
bool qunsetenv (const char *varName)
This function deletes the variable varName from the environment.
Returns true on success.
This function was introduced in Qt 5.1.
Macro Documentation
QT_DISABLE_DEPRECATED_BEFORE
This macro can be defined in the project file to disable functions deprecated in a specified version of Qt or any earlier version. The default version number is 5.0, meaning that functions deprecated in or before Qt 5.0 will not be included.
Examples: When using a future release of Qt 5, set QT_DISABLE_DEPRECATED_BEFORE=0x050100 to disable functions deprecated in Qt 5.1 and earlier. In any release, set QT_DISABLE_DEPRECATED_BEFORE=0x000000 to enable any functions, including the ones deprecated in Qt 5.0
QT_POINTER_SIZE
Expands to the size of a pointer in bytes (4 or 8). This is equivalent to sizeof(void *) but can be used in a preprocessor directive.
QT_REQUIRE_VERSION ( int argc, char **argv, const char *version)
This macro can be used to ensure that the application is run against a recent enough version of Qt. This is especially useful if your application depends on a specific bug fix introduced in a bug-fix release (e.g., 4.0.2).
The argc and argv parameters are the main() function’s argc and argv parameters. The version parameter is a string literal that specifies which version of Qt the application requires (e.g., «4.0.2»).
QT_TRANSLATE_NOOP3 (context, sourceText, comment)
Marks the string literal sourceText for dynamic translation in the given context and with comment, i.e the stored sourceText will not be altered. The context is typically a class and also needs to be specified as string literal. The string literal comment will be available for translators using e.g. Qt Linguist.
The macro expands to anonymous struct of the two string literals passed as sourceText and comment.
This function was introduced in Qt 4.4.
QT_TRANSLATE_NOOP (context, sourceText)
Marks the string literal sourceText for dynamic translation in the given context; i.e, the stored sourceText will not be altered. The context is typically a class and also needs to be specified as string literal.
The macro expands to sourceText.
QT_TRID_NOOP (id)
The QT_TRID_NOOP macro marks an id for dynamic translation.
The only purpose of this macro is to provide an anchor for attaching meta data like to qtTrId().
The macro expands to id.
This function was introduced in Qt 4.6.
QT_TR_NOOP (sourceText)
Marks the string literal sourceText for dynamic translation in the current context (class), i.e the stored sourceText will not be altered.
The macro expands to sourceText.
The macro QT_TR_NOOP_UTF8() is identical except that it tells lupdate that the source string is encoded in UTF-8. Corresponding variants exist in the QT_TRANSLATE_NOOP() family of macros, too.
QT_VERSION
This macro expands a numeric value of the form 0xMMNNPP (MM = major, NN = minor, PP = patch) that specifies Qt’s version number. For example, if you compile your application against Qt 4.1.2, the QT_VERSION macro will expand to 0x040102.
You can use QT_VERSION to use the latest Qt features where available.
QT_VERSION_CHECK
Turns the major, minor and patch numbers of a version into an integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can be compared with another similarly processed version id.
QT_VERSION_STR
This macro expands to a string that specifies Qt’s version number (for example, «4.1.2»). This is the version against which the application is compiled.
void Q_ASSERT ( bool test)
Q_ASSERT() is useful for testing pre- and post-conditions during development. It does nothing if QT_NO_DEBUG was defined during compilation.
If b is zero, the Q_ASSERT statement will output the following message using the qFatal() function:
void Q_ASSERT_X ( bool test, const char *where, const char *what)
Q_ASSERT_X is useful for testing pre- and post-conditions during development. It does nothing if QT_NO_DEBUG was defined during compilation.
If b is zero, the Q_ASSERT_X statement will output the following message using the qFatal() function:
void Q_ASSUME ( bool expr)
If expr is a constantly false condition, Q_ASSUME will tell the compiler that the current code execution cannot be reached. That is, Q_ASSUME(false) is equivalent to Q_UNREACHABLE().
In debug builds the condition is enforced by an assert to facilitate debugging.
Note: Q_LIKELY() tells the compiler that the expression is likely, but not the only possibility. Q_ASSUME tells the compiler that it is the only possibility.
This function was introduced in Qt 5.0.
Q_BIG_ENDIAN
This macro represents a value you can compare to the macro Q_BYTE_ORDER to determine the endian-ness of your system. In a big-endian system, the most significant byte is stored at the lowest address. The other bytes follow in decreasing order of significance.
Q_BYTE_ORDER
This macro can be used to determine the byte order your system uses for storing data in memory. i.e., whether your system is little-endian or big-endian. It is set by Qt to one of the macros Q_LITTLE_ENDIAN or Q_BIG_ENDIAN. You normally won’t need to worry about endian-ness, but you might, for example if you need to know which byte of an integer or UTF-16 character is stored in the lowest address. Endian-ness is important in networking, where computers with different values for Q_BYTE_ORDER must pass data back and forth.
Use this macro as in the following examples.
Q_CC_BOR
Defined if the application is compiled using Borland/Turbo C++.
Q_CC_CDS
Defined if the application is compiled using Reliant C++.
Q_CC_COMEAU
Defined if the application is compiled using Comeau C++.
Q_CC_DEC
Defined if the application is compiled using DEC C++.
Q_CC_EDG
Defined if the application is compiled using Edison Design Group C++.
Q_CC_GHS
Defined if the application is compiled using Green Hills Optimizing C++ Compilers.
Q_CC_GNU
Defined if the application is compiled using GNU C++.
Q_CC_HIGHC
Defined if the application is compiled using MetaWare High C/C++.
Q_CC_HPACC
Defined if the application is compiled using HP aC++.
Q_CC_INTEL
Defined if the application is compiled using Intel C++ for Linux, Intel C++ for Windows.
Q_CC_KAI
Defined if the application is compiled using KAI C++.
Q_CC_MIPS
Defined if the application is compiled using MIPSpro C++.
Q_CC_MSVC
Defined if the application is compiled using Microsoft Visual C/C++, Intel C++ for Windows.
Q_CC_OC
Defined if the application is compiled using CenterLine C++.
Q_CC_PGI
Defined if the application is compiled using Portland Group C++.
Q_CC_SUN
Defined if the application is compiled using Forte Developer, or Sun Studio C++.
Q_CC_SYM
Defined if the application is compiled using Digital Mars C/C++ (used to be Symantec C++).
Q_CC_USLC
Defined if the application is compiled using SCO OUDK and UDK.
Q_CC_WAT
Defined if the application is compiled using Watcom C++.
void Q_CHECK_PTR ( void *pointer)
If pointer is 0, prints a message containing the source code’s file name and line number, saying that the program ran out of memory and aborts program execution. It throws std::bad_alloc instead if exceptions are enabled.
Q_CHECK_PTR does nothing if QT_NO_DEBUG and QT_NO_EXCEPTIONS were defined during compilation. Therefore you must not use Q_CHECK_PTR to check for successful memory allocations because the check will be disabled in some cases.
Q_DECLARE_TYPEINFO (Type, Flags)
You can use this macro to specify information about a custom type Type. With accurate type information, Qt’s generic containers can choose appropriate storage methods and algorithms.
Flags can be one of the following:
Example of a «primitive» type:
An example of a non-POD «primitive» type is QUuid: Even though QUuid has constructors (and therefore isn’t POD), every bit pattern still represents a valid object, and memcpy() can be used to create a valid independent copy of a QUuid object.
Example of a movable type:
Q_DECL_CONSTEXPR
This macro can be used to declare variable that should be constructed at compile-time, or an inline function that can be computed at compile-time.
It expands to «constexpr» if your compiler supports that C++11 keyword, or to nothing otherwise.
Q_DECL_EXPORT
This macro marks a symbol for shared library export (see Creating Shared Libraries).
Q_DECL_FINAL
This macro can be used to declare an overriding virtual or a class as «final», with Java semantics. Further-derived classes can then no longer override this virtual function, or inherit from this class, respectively.
It expands to «final» if your compiler supports that C++11 contextual keyword, or something non-standard if your compiler supports something close enough to the C++11 semantics, or to nothing otherwise.
For classes, it goes in front of the : in the class definition, if any:
This function was introduced in Qt 5.0.
Q_DECL_IMPORT
This macro declares a symbol to be an import from a shared library (see Creating Shared Libraries).
Q_DECL_NOEXCEPT
This macro marks a function as never throwing. If the function does nevertheless throw, the behaviour is defined: std::terminate() is called.
The macro expands to C++11 noexcept, if available, or to nothing otherwise.
If you need the operator version of C++11 noexcept, use Q_DECL_NOEXCEPT_EXPR(x).
If you don’t need C++11 noexcept semantics, e.g. because your function can’t possibly throw, don’t use this macro, use Q_DECL_NOTHROW instead.
This function was introduced in Qt 5.0.
Q_DECL_NOEXCEPT_EXPR (x)
The macro expands to C++11 noexcept(x), if available, or to nothing otherwise.
If you need the always-true version of C++11 noexcept, use Q_DECL_NOEXCEPT.
If you don’t need C++11 noexcept semantics, e.g. because your function can’t possibly throw, don’t use this macro, use Q_DECL_NOTHROW instead.
This function was introduced in Qt 5.0.
Q_DECL_NOTHROW
This macro marks a function as never throwing, under no circumstances. If the function does nevertheless throw, the behaviour is undefined.
The macro expands to either «throw()», if that has some benefit on the compiler, or to C++11 noexcept, if available, or to nothing otherwise.
If you need C++11 noexcept semantics, don’t use this macro, use Q_DECL_NOEXCEPT/Q_DECL_NOEXCEPT_EXPR instead.
This function was introduced in Qt 5.0.
Q_DECL_OVERRIDE
This macro can be used to declare an overriding virtual function. Use of this markup will allow the compiler to generate an error if the overriding virtual function does not in fact override anything.
It expands to «override» if your compiler supports that C++11 contextual keyword, or to nothing otherwise.
This function was introduced in Qt 5.0.
Q_DECL_RELAXED_CONSTEXPR
This macro can be used to declare an inline function that can be computed at compile-time according to the relaxed rules from C++14.
It expands to «constexpr» if your compiler supports C++14 relaxed constant expressions, or to nothing otherwise.
Q_FOREACH (variable, container)
Same as foreach(variable, container).
Note: Since Qt 5.7, the use of this macro is discouraged. It will be removed in a future version of Qt. Please use C++11 range-for, possibly with qAsConst(), as needed.
Q_FOREVER
Q_FORWARD_DECLARE_CF_TYPE (type)
Forward-declares a Core Foundation type. This includes the actual type and the ref type. For example, Q_FORWARD_DECLARE_CF_TYPE(CFString) declares __CFString and CFStringRef.
This function was introduced in Qt 5.2.
Q_FORWARD_DECLARE_MUTABLE_CF_TYPE (type)
Forward-declares a mutable Core Foundation type. This includes the actual type and the ref type. For example, Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(CFMutableString) declares __CFMutableString and CFMutableStringRef.
This function was introduced in Qt 5.2.
Q_FORWARD_DECLARE_OBJC_CLASS (classname)
Forward-declares an Objective-C classname in a manner such that it can be compiled as either Objective-C or C++.
This is primarily intended for use in header files that may be included by both Objective-C and C++ source files.
This function was introduced in Qt 5.2.
const char * Q_FUNC_INFO ()
Expands to a string that describe the function the macro resides in. How this string looks more specifically is compiler dependent. With GNU GCC it is typically the function signature, while with other compilers it might be the line and column number.
Q_FUNC_INFO can be conveniently used with qDebug(). For example, this function:
when instantiated with the integer type, will with the GCC compiler produce:
const TInputType& myMin(const TInputType&, const TInputType&) [with TInputType = int] was called with value1: 3 value2: 4
If this macro is used outside a function, the behavior is undefined.
qint64 Q_INT64_C (literal)
Wraps the signed 64-bit integer literal in a platform-independent way.
Q_LIKELY (expr)
Use of this macro can help the compiler to optimize the code.
This function was introduced in Qt 4.8.
Q_LITTLE_ENDIAN
This macro represents a value you can compare to the macro Q_BYTE_ORDER to determine the endian-ness of your system. In a little-endian system, the least significant byte is stored at the lowest address. The other bytes follow in increasing order of significance.