http___qt-project.org_wiki_Category_GlobalTanimlamalar_1.xml
1.1 2.1 2.2 3.1 4.1 5.1 6.1 7.1 7.2 7.3 8.1 9.1 9.2 10.1 11.1 11.2 11.3 12.1 13.1 13.2 13.3 13.4 14.1 15.1 16.1 16.2 17.1 18.1 19.1 20.1 21.1 21.2 21.3 21.4 22.1 23.1 23.2 23.3 24.1 24.2 24.3 25.1 26.1 27.1 28.1 29.1 30.1 31.1 32.1 33.1 34.1 35.1 36.1 37.1 38.1 39.1 40.1 41.1 42.1 42.2 43.1 44.1 45.1 45.2 46.1 47.1 47.2 48.1 49.1 49.2 50.1 51.1 51.2 52.1 54.1 55.1 56.1 57.1 57.2 57.3 58.1 58.2 59.1 60.1 61.1 61.2 62.1 63.1 64.1 65.1 65.2 65.3 66.1 66.2 67.1 68.1 69.1 69.2 70.1 71.1 71.2 72.1 73.1 73.2 74.1 75.1 75.2 76.1 77.1 77.2 78.1 80.1 81.1 82.1 83.1 83.2 83.3 84.1 84.2 85.1 86.1 87.1 87.2 88.1 89.1 90.1 91.1 92.1 93.1 94.1 95.1 96.1 97.1 98.1 99.1 99.2 100.1 101.1 102.1 103.1 103.2 104.1 105.1 106.1 107.1 108.1 108.2 109.1 110.1 111.1 112.1 113.1 114.1 115.1 116.1 117.1 118.1 119.1 120.1 121.1 121.2 122.1 122.2 122.3 122.4 123.1 123.2 124.1 125.1 126.1 127.1 128.1 129.1 130.1 131.1 132.1 132.2 133.1 134.1 135.1 136.1 137.1 138.1 139.1 140.1 141.1 142.1 143.1 144.1 145.1 146.1 147.1 148.1 149.1 150.1 151.1 152.1 153.1 154.1 155.1 156.1 157.1 158.1 159.1 160.1 161.1 162.1 163.1 164.1 165.1 166.1 167.1 168.1 169.1 170.1 171.1 172.1 173.1 174.1 175.1 176.1 176.2 177.1 178.1 179.1 180.1 181.1 182.1 182.2 183.1 183.2 184.1 185.1 186.1 186.2 186.3 187.1 187.2 188.1 189.1 190.1 191.1 192.1 193.1 194.1 195.1 196.1 197.1 198.1 198.2 199.1 200.1 201.1 202.1 203.1 203.2 203.3 204.1 204.2 205.1 205.2 207.1 208.1 209.1 210.1 210.2 211.1 212.1 212.2 212.3 213.1 214.1 215.1 216.1 217.1 218.1 218.2 219.1 219.2 220.1 221.1 221.2 222.1 223.1 223.2 224.1 224.2 225.1 226.1 227.1 228.1 228.2 228.3 229.1 230.1 231.1 232.1 233.1 234.1 235.1 235.2 236.1 237.1 238.1 239.1 240.1 241.1 242.1 243.1 244.1 245.1 245.2 245.3 246.1 247.1 248.1 249.1 250.1 251.1 252.1 253.1 253.2 254.1 255.1 256.1 256.2 257.1 258.1 259.1 260.1 261.1 262.1 262.2 263.1 264.1 265.1 266.1 267.1 267.2 268.1 269.1 270.1 271.1 271.2 272.1 273.1 274.1 275.1 276.1 277.1 278.1 279.1 279.2 280.1 281.1 282.1 283.1 284.1 285.1 286.1 286.2 286.3 287.1 287.2 287.3 288.1 288.2 289.1 290.1 290.2 291.1 292.1 293.1 294.1 294.2 294.3 295.1 296.1 297.1 298.1 298.2 298.3 298.4 298.5 299.1 300.1 301.1 302.1 303.1 304.1 305.1 306.1 307.1 308.1 309.1 310.1 311.1 312.1 313.1 314.1 315.1 316.1 317.1 318.1 319.1 320.1 321.1 322.1 323.1 324.1 325.1 326.1 327.1 328.1 329.1 330.1 331.1 332.1 333.1 334.1 335.1 336.1 337.1 338.1 339.1 340.1 341.1 342.1 343.1 344.1 344.2 345.1 346.1 347.1 347.2 348.1 349.1 350.1 351.1 352.1 353.1 354.1 355.1 356.1 357.1 358.1 359.1 360.1 361.1 362.1 363.1 364.1 364.2 365.1 366.1 367.1 368.1 369.1 370.1 371.1 372.1 373.1 374.1 375.1 376.1 376.2 377.1 378.1 379.1 380.1 381.1 382.1 383.1 383.2 384.1 385.1 386.1 387.1 388.1 389.1 390.1 390.2 391.1 392.1 393.1 394.1 395.1 396.1 396.2 397.1 398.1 399.1 400.1 401.1 402.1 403.1 404.1 405.1 406.1 407.1 408.1 409.1 410.1 411.1 411.2 411.3 412.1 412.2 413.1 414.1 415.1 416.1 417.1 418.1 419.1 421.1 422.1 423.1 424.1 425.1 426.1 427.1 428.1 429.1 430.1 430.2 430.3 431.1 432.1 433.1 434.1 435.1 436.1 437.1 438.1 439.1 440.1 441.1 442.1 443.1 444.1 445.1 446.1 447.1 448.1 449.1 450.1 451.1 452.1 453.1 454.1 455.1 456.1 457.1 458.1 459.1 460.1 461.1 462.1 463.1 464.1 465.1 466.1 467.1 468.1 469.1 470.1 471.1 472.1 473.1 474.1 475.1 476.1 477.1 478.1 479.1 480.1 481.1 482.1 483.1 484.1 485.1 486.1 486.2 487.1 488.1 488.2 489.1 490.1 491.1 492.1 492.2 493.1 494.1 494.2 495.1 496.1 496.2 497.1 498.1 498.2 499.1 500.1 501.1 502.1 503.1 504.1 504.2 505.1 506.1 506.2 507.1 508.1 508.2 509.1 510.1 510.2 511.1 512.1 512.2 513.1 514.1 514.2 515.1 516.1 516.2 517.1 518.1 518.2 519.1 520.1 520.2 521.1 522.1 522.2 523.1 524.1 524.2 525.1 526.1 526.2 527.1 528.1 528.2 529.1 530.1 530.2 531.1 532.1 532.2 533.1 534.1 534.2 535.1 536.1 536.2 537.1 538.1 538.2 538.3 539.1 540.1 540.2 540.3 541.1 542.1 543.1 545.1 546.1 547.1 548.1 549.1 550.1 551.1 552.1 553.1 554.1 555.1 555.2 556.1 557.1 558.1 559.1 559.2 559.3 560.1 561.1 562.1 563.1 564.1 565.1 565.2 566.1 567.1 567.2 567.3 568.1 569.1 570.1 571.1 572.1 573.1 574.1 575.1 576.1 577.1 578.1 579.1 580.1 580.2 580.3 580.4 581.1 581.2 582.1 583.1 584.1 585.1 586.1 587.1 588.1 589.1 590.1 590.2 590.3 590.4 590.5 591.1 591.2 592.1 593.1 594.1 595.1 596.1 596.2 596.3 597.1 598.1 599.1 600.1 600.2 600.3 600.4 601.1 601.2 602.1 603.1 604.1 605.1 606.1 607.1 608.1 609.1 610.1 610.2 611.1 611.2 612.1 613.1 614.1 615.1 616.1 616.2 616.3 616.4 616.5 617.1 617.2 618.1 619.1 620.1 621.1 622.1 623.1 624.1
- Global Qt Declarations The   header file includes the fundamental global declarations. It is included by most other Qt header files. Types Functions Macros 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). Several convenience type definitions are declared: qreal for double, uchar for unsigned char, uint for unsigned int, ulong for unsigned long and ushort for 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 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. 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: int myValue = 10; int minValue = 2; int maxValue = 6; int boundedValue = qBound(minValue, myValue, maxValue); // boundedValue == 6 also contains functions that generate messages from the given string argument: qCritical(), qDebug(), qFatal() and qWarning(). These functions call the message handler with the given message. Example: if (!driver()->isOpen() || driver()->isOpenError()) { qWarning("QSqlQuery::exec: database not open"); return false; } 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_X11 which is defined for the X Window System. 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() macro 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. See also   and QSysInfo. Type Documentation typedef QFunctionPointer This is a typedef for void (*)(), a pointer to a function that takes no arguments and returns void. typedef QtMessageHandler This is a typedef for a pointer to a function with the following signature: void myMessageHandler(QtMsgType, const QMessageLogContext &, const QString &); This typedef was introduced in QtCore 5.0. See also QtMsgType and qInstallMessageHandler(). typedef QtMsgHandler This typedef is deprecated. This is a typedef for a pointer to a function with the following signature: void myMsgHandler(QtMsgType, const char *); This typedef is deprecated, you should use QtMessageHandler instead. See also QtMsgType, QtMessageHandler, qInstallMsgHandler(), and qInstallMessageHandler(). enum QtMsgType This enum describes the messages that can be sent to a message handler (QtMsgHandler). You can use the enum to identify and associate the various message types with the appropriate actions. See also QtMessageHandler and qInstallMessageHandler(). typedef qint8 Typedef for signed char. This type is guaranteed to be 8-bit on all platforms supported by Qt. typedef qint16 Typedef for signed short. This type is guaranteed to be 16-bit on all platforms supported by Qt. typedef qint32 Typedef for signed int. This type is guaranteed to be 32-bit on all platforms supported by Qt. 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: See also Q_INT64_C(), quint64, and qlonglong. 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. See also qptrdiff, qint32, and qint64. typedef qlonglong Typedef for long long int (__int64 on Windows). This is the same as qint64. See also qulonglong and 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. See also quintptr, qint32, and qint64. typedef qreal Typedef for double on all platforms except for those using CPUs with ARM architectures. On ARM-based platforms, qreal is a typedef for float for performance reasons. typedef quint8 Typedef for unsigned char. This type is guaranteed to be 8-bit on all platforms supported by Qt. typedef quint16 Typedef for unsigned short. This type is guaranteed to be 16-bit on all platforms supported by Qt. typedef quint32 Typedef for unsigned int. This type is guaranteed to be 32-bit on all platforms supported by Qt. 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: See also Q_UINT64_C(), qint64, and qulonglong. 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. See also qptrdiff, quint32, and quint64. typedef qulonglong Typedef for unsigned long long int (unsigned __int64 on Windows). This is the same as quint64. See also quint64 and qlonglong. typedef uchar Convenience typedef for unsigned char. typedef uint Convenience typedef for unsigned int. typedef ulong Convenience typedef for unsigned long. typedef ushort Convenience typedef for unsigned short. 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. Example: int absoluteValue; int myValue = -4; absoluteValue = qAbs(myValue); // absoluteValue == 4 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)). Example: int myValue = 10; int minValue = 2; int maxValue = 6; int boundedValue = qBound(minValue, myValue, maxValue); // boundedValue == 6 bool qFuzzyCompare(double p1, double p2) [static] Compares the floating point value p1 and p2 and returns true if they are considered equal, otherwise false. 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. // Instead of comparing with 0.0 qFuzzyCompare(0.0,1.0e-200); // This will return false // Compare adding 1 to both values will fix the problem qFuzzyCompare(1 + 0.0, 1 + 1.0e-200); // This will return true The two numbers are compared in a relative way, where the exactness is stronger the smaller the numbers are. Note: This function is thread-safe. This function was introduced in QtCore 4.4. bool qFuzzyCompare(float p1, float p2) [static] Compares the floating point value p1 and p2 and returns true if they are considered equal, otherwise false. The two numbers are compared in a relative way, where the exactness is stronger the smaller the numbers are. Note: This function is thread-safe. This function was introduced in QtCore 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 (which may be 0). 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. To restore the message handler, call qInstallMessageHandler(0). Example: #include   #include   #include   void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) { QByteArray localMsg = msg.toLocal8Bit(); switch (type) { case QtDebugMsg: fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); break; case QtWarningMsg: fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); break; case QtCriticalMsg: fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); break; case QtFatalMsg: fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); abort(); } } int main(int argc, char **argv) { qInstallMessageHandler(myMessageOutput); QApplication app(argc, argv); ... return app.exec(); } This function was introduced in QtCore 5.0. See also QtMessageHandler, QtMsgType, qDebug(), qWarning(), qCritical(), qFatal(), and Debugging Techniques. QtMsgHandler qInstallMsgHandler(QtMsgHandler handler) This function is deprecated. Installs a Qt message handler which has been defined previously. This method is deprecated, use qInstallMessageHandler instead. See also QtMsgHandler and qInstallMessageHandler(). 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. Example: int myValue = 6; int yourValue = 4; int maxValue = qMax(myValue, yourValue); // maxValue == myValue const T & qMin(const T & value1, const T & value2) Returns the minimum of value1 and value2. Example: int myValue = 6; int yourValue = 4; int minValue = qMin(myValue, yourValue); // minValue == yourValue 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. Example: qreal valueA = 42949672960.3; qreal valueB = 42949672960.7; int roundedValueA = qRound(valueA); // roundedValueA = 42949672960 int roundedValueB = qRound(valueB); // roundedValueB = 42949672961 int qRound(qreal value) Rounds value to the nearest integer. Example: qreal valueA = 2.3; qreal valueB = 2.7; int roundedValueA = qRound(valueA); // roundedValueA = 2 int roundedValueB = qRound(valueB); // roundedValueB = 3 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(), qWarning(), qCritical() and qFatal(). Following placeholders are supported: The default pattern is "%{message}". 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. qSetMessagePattern() has no effect if a custom message handler is installed. This function was introduced in QtCore 5.0. See also qInstallMessageHandler() and Debugging Techniques. 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. See also QT_VERSION_STR. 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. See also qputenv(). 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. 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. See also qgetenv(). 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 QtCore 4.2. See also qsrand(). 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 calls qrand(), the threads will get the same random number sequence. This function was introduced in QtCore 4.2. See also qrand(). QString qtTrId(const char * id, int n = -1) 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: or \begincomment%   \endcomment Example: //% "%n fooish bar(s) found.\n" //% "Do you want to continue?" QString text = qtTrId("qtn_foo_bar", n); Creating QM files suitable for use with this function requires passing the -idbased option to the lrelease tool. 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 QtCore 4.6. See also QObject::tr(), QCoreApplication::translate(), and Internationalization with Qt. 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"). Example: #include   #include   int main(int argc, char *argv[]) { QT_REQUIRE_VERSION(argc, argv, "4.0.2") QApplication app(argc, argv); ... return app.exec(); } 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. Example: static { const char *source; const char *comment; } greeting_strings[] = { QT_TRANSLATE_NOOP3("FriendlyConversation", "Hello", "A really friendly hello"), QT_TRANSLATE_NOOP3("FriendlyConversation", "Goodbye", "A really friendly goodbye") }; QString FriendlyConversation::greeting(int type) { return tr(greeting_strings[type].source, greeting_strings[type].comment); } QString global_greeting(int type) { return qApp->translate("FriendlyConversation", greeting_strings[type].source, greeting_strings[type].comment); } This function was introduced in QtCore 4.4. See also QT_TR_NOOP(), QT_TRANSLATE_NOOP(), and Internationalization with Qt. 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. Example: static const char *greeting_strings[] = { QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"), QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye") }; QString FriendlyConversation::greeting(int type) { return tr(greeting_strings[type]); } QString global_greeting(int type) { return qApp->translate("FriendlyConversation", greeting_strings[type]); } See also QT_TR_NOOP(), QT_TRANSLATE_NOOP3(), and Internationalization with Qt. 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. Example: static const char * const ids[] = { //% "This is the first text." QT_TRID_NOOP("qtn_1st_text"), //% "This is the second text." QT_TRID_NOOP("qtn_2nd_text"), 0 }; void TheClass::addLabels() { for (int i = 0; ids[i]; ++i) new QLabel(qtTrId(ids[i]), this); } This function was introduced in QtCore 4.6. See also qtTrId() and Internationalization with Qt. 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. Example: QString FriendlyConversation::greeting(int type) { static const char *greeting_strings[] = { QT_TR_NOOP("Hello"), QT_TR_NOOP("Goodbye") }; return tr(greeting_strings[type]); } 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. See also QT_TRANSLATE_NOOP() and Internationalization with Qt. 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. Example: #if QT_VERSION >= 0x040100 QIcon icon = style()->standardIcon(QStyle::SP_TrashIcon); #else QPixmap pixmap = style()->standardPixmap(QStyle::SP_TrashIcon); QIcon icon(pixmap); #endif See also QT_VERSION_STR and qVersion(). 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. Example: #include   #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include   #else #include   #endif See also QT_VERSION. 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. See also qVersion() and QT_VERSION. void Q_ASSERT(bool test) Prints a warning message containing the source code file name and line number if test is false. Q_ASSERT() is useful for testing pre- and post-conditions during development. It does nothing if QT_NO_DEBUG was defined during compilation. Example: // File: div.cpp #include   int divide(int a, int b) { Q_ASSERT(b != 0); return a / b; } If b is zero, the Q_ASSERT statement will output the following message using the qFatal() function: ASSERT: "b == 0" in file div.cpp, line 7 See also Q_ASSERT_X(), qFatal(), and Debugging Techniques. void Q_ASSERT_X(bool test, const char * where, const char * what) Prints the message what together with the location where, the source file name and line number if test is false. Q_ASSERT_X is useful for testing pre- and post-conditions during development. It does nothing if QT_NO_DEBUG was defined during compilation. Example: // File: div.cpp #include   int divide(int a, int b) { Q_ASSERT_X(b != 0, "divide", "division by zero"); return a / b; } If b is zero, the Q_ASSERT_X statement will output the following message using the qFatal() function: ASSERT failure in divide: "division by zero", file div.cpp, line 7 See also Q_ASSERT(), qFatal(), and Debugging Techniques. void Q_ASSUME(bool expr) Causes the compiler to assume that expr is true. This macro is useful for improving code generation, by providing the compiler with hints about conditions that it would not otherwise know about. However, there is no guarantee that the compiler will actually use those hints. This macro could be considered a "lighter" version of Q_ASSERT. While Q_ASSERT will abort the program's execution if the condition is false, Q_ASSUME will tell the compiler not to generate code for those conditions. Therefore, it is important that the assumptions always hold, otherwise undefined behaviour may occur. 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 QtCore 5.0. See also Q_ASSERT(), Q_UNREACHABLE(), and Q_LIKELY(). 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. #if Q_BYTE_ORDER == Q_BIG_ENDIAN ... #endif See also Q_BYTE_ORDER and Q_LITTLE_ENDIAN. 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. #if Q_BYTE_ORDER == Q_BIG_ENDIAN ... #endif or #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN ... #endif See also Q_BIG_ENDIAN and Q_LITTLE_ENDIAN. 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 warning message containing the source code's file name and line number, saying that the program ran out of memory. Q_CHECK_PTR does nothing if QT_NO_DEBUG was defined during compilation. Example: int *a; Q_CHECK_PTR(a = new int[80]); // WRONG! a = new (nothrow) int[80]; // Right Q_CHECK_PTR(a); See also qWarning() and Debugging Techniques. 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: - Q_PRIMITIVE_TYPE specifies that Type is a POD (plain old data) type with no constructor or destructor, or else a type where every bit pattern is a valid object and memcpy() creates a valid independent copy of the object. - Q_MOVABLE_TYPE specifies that Type has a constructor and/or a destructor but can be moved in memory using memcpy(). - Q_COMPLEX_TYPE (the default) specifies that Type has constructors and/or a destructor and that it may not be moved in memory. Example of a "primitive" type: struct Point2D { int x; int y; }; Q_DECLARE_TYPEINFO(Point2D, Q_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: class Point2D { public: Point2D() { data = new int[2]; } Point2D(const Point2D &other) { ... } ~Point2D() { delete[] data; } Point2D &operator=(const Point2D &other) { ... } int x() const { return data[0]; } int y() const { return data[1]; } private: int *data; }; Q_DECLARE_TYPEINFO(Point2D, Q_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). See also Q_DECL_IMPORT. 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. The macro goes at the end of the function, usually after the const, if any: // more-derived classes no longer permitted to override this: virtual void MyWidget::paintEvent(QPaintEvent*) Q_DECL_FINAL; For classes, it goes in front of the : in the class definition, if any: class QRect Q_DECL_FINAL { // cannot be derived from // ... }; This function was introduced in QtCore 5.0. See also Q_DECL_OVERRIDE. Q_DECL_IMPORT This macro declares a symbol to be an import from a shared library (see Creating Shared Libraries). See also Q_DECL_EXPORT. 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 QtCore 5.0. See also Q_DECL_NOTHROW and Q_DECL_NOEXCEPT_EXPR. Q_DECL_NOEXCEPT_EXPR( x) This macro marks a function as non-throwing if x is true. If the function does nevertheless throw, the behaviour is defined: std::terminate() is called. 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 QtCore 5.0. See also Q_DECL_NOTHROW and Q_DECL_NOEXCEPT_EXPR. 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 QtCore 5.0. See also Q_DECL_NOEXCEPT and Q_DECL_NOEXCEPT_EXPR. 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. The macro goes at the end of the function, usually after the const, if any: // generate error if this doesn't actually override anything: virtual void MyWidget::paintEvent(QPaintEvent*) Q_DECL_OVERRIDE; This function was introduced in QtCore 5.0. See also Q_DECL_FINAL. Q_FOREACH( variable, container) Same as foreach(variable, container). This macro is available even when no_keywords is specified using the .pro file's CONFIG variable. See also foreach(). Q_FOREVER Same as forever. This macro is available even when no_keywords is specified using the .pro file's CONFIG variable. See also foreach(). 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: template  const TInputType &myMin(const TInputType &value1, const TInputType &value2) { qDebug() << Q_FUNC_INFO << "was called with value1:" << value1 << "value2:" << value2; if(value1 < value2) return value1; else return value2; } 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. Example: See also qint64 and Q_UINT64_C(). Q_LIKELY( expr) Hints to the compiler that the enclosed condition, expr, is likely to evaluate to true. Use of this macro can help the compiler to optimize the code. Example: // the condition inside the "if" will be successful most of the times for (int i = 1; i <= 365; i++) { if (Q_LIKELY(isWorkingDay(i))) { ... } ... } This function was introduced in QtCore 4.8. See also Q_UNLIKELY(). 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. #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN ... #endif See also Q_BYTE_ORDER and Q_BIG_ENDIAN. Q_OS_AIX Defined on AIX. Q_OS_BSD4 Defined on Any BSD 4.4 system. Q_OS_BSDI Defined on BSD/OS. Q_OS_CYGWIN Defined on Cygwin. Q_OS_DARWIN Defined on Darwin OS (synonym for Q_OS_MAC). Q_OS_DGUX Defined on DG/UX. Q_OS_DYNIX Defined on DYNIX/ptx. Q_OS_FREEBSD Defined on FreeBSD. Q_OS_HPUX Defined on HP-UX. Q_OS_HURD Defined on GNU Hurd. Q_OS_IRIX Defined on SGI Irix. Q_OS_LINUX Defined on Linux. Q_OS_LYNX Defined on LynxOS. Q_OS_MAC Defined on MAC OS (synonym for Darwin). Q_OS_NETBSD Defined on NetBSD. Q_OS_OPENBSD Defined on OpenBSD. Q_OS_OSF Defined on HP Tru64 UNIX. Q_OS_QNX Defined on QNX Neutrino. Q_OS_RELIANT Defined on Reliant UNIX. Q_OS_SCO Defined on SCO OpenServer 5. Q_OS_SOLARIS Defined on Sun Solaris. Q_OS_ULTRIX Defined on DEC Ultrix. Q_OS_UNIX Defined on Any UNIX BSD/SYSV system. Q_OS_UNIXWARE Defined on UnixWare 7, Open UNIX 8. Q_OS_WIN32 Defined on all supported versions of Windows. Q_OS_WINCE Defined on Windows CE. Q_PROCESSOR_X86 Defined if the application is compiled for x86 processors. Qt currently supports two x86 variants: Q_PROCESSOR_X86_32 and Q_PROCESSOR_X86_64. Q_PROCESSOR_S390 Defined if the application is compiled for S/390 processors. Qt supports one optional variant of S/390: Q_PROCESSOR_S390_X. Q_PROCESSOR_ALPHA Defined if the application is compiled for Alpha processors. Q_PROCESSOR_ARM Defined if the application is compiled for ARM processors. Qt currently supports three optional ARM revisions: Q_PROCESSOR_ARM_V5, Q_PROCESSOR_ARM_V6, and Q_PROCESSOR_ARM_V7. Q_PROCESSOR_ARM_V5 Defined if the application is compiled for ARMv5 processors. The Q_PROCESSOR_ARM macro is also defined when Q_PROCESSOR_ARM_V5 is defined. Q_PROCESSOR_ARM_V6 Defined if the application is compiled for ARMv6 processors. The Q_PROCESSOR_ARM and Q_PROCESSOR_ARM_V5 macros are also defined when Q_PROCESSOR_ARM_V6 is defined. Q_PROCESSOR_ARM_V7 Defined if the application is compiled for ARMv7 processors. The Q_PROCESSOR_ARM, Q_PROCESSOR_ARM_V5, and Q_PROCESSOR_ARM_V6 macros are also defined when Q_PROCESSOR_ARM_V7 is defined. Q_PROCESSOR_AVR32 Defined if the application is compiled for AVR32 processors. Q_PROCESSOR_BLACKFIN Defined if the application is compiled for Blackfin processors. Q_PROCESSOR_IA64 Defined if the application is compiled for IA-64 processors. This includes all Itanium and Itanium 2 processors. Q_PROCESSOR_MIPS Defined if the application is compiled for MIPS processors. Qt currently supports seven MIPS revisions: Q_PROCESSOR_MIPS_I, Q_PROCESSOR_MIPS_II, Q_PROCESSOR_MIPS_III, Q_PROCESSOR_MIPS_IV, Q_PROCESSOR_MIPS_V, Q_PROCESSOR_MIPS_32, and Q_PROCESSOR_MIPS_64. Q_PROCESSOR_MIPS_32 Defined if the application is compiled for MIPS32 processors. The Q_PROCESSOR_MIPS, Q_PROCESSOR_MIPS_I, and Q_PROCESSOR_MIPS_II macros are also defined when Q_PROCESSOR_MIPS_32 is defined. Q_PROCESSOR_MIPS_64 Defined if the application is compiled for MIPS64 processors. The Q_PROCESSOR_MIPS, Q_PROCESSOR_MIPS_I, Q_PROCESSOR_MIPS_II, Q_PROCESSOR_MIPS_III, Q_PROCESSOR_MIPS_IV, and Q_PROCESSOR_MIPS_V macros are also defined when Q_PROCESSOR_MIPS_64 is defined. Q_PROCESSOR_MIPS_I Defined if the application is compiled for MIPS-I processors. The Q_PROCESSOR_MIPS macro is also defined when Q_PROCESSOR_MIPS_I is defined. Q_PROCESSOR_MIPS_II Defined if the application is compiled for MIPS-II processors. The Q_PROCESSOR_MIPS and Q_PROCESSOR_MIPS_I macros are also defined when Q_PROCESSOR_MIPS_II is defined. Q_PROCESSOR_MIPS_III Defined if the application is compiled for MIPS-III processors. The Q_PROCESSOR_MIPS, Q_PROCESSOR_MIPS_I, and Q_PROCESSOR_MIPS_II macros are also defined when Q_PROCESSOR_MIPS_III is defined. Q_PROCESSOR_MIPS_IV Defined if the application is compiled for MIPS-IV processors. The Q_PROCESSOR_MIPS, Q_PROCESSOR_MIPS_I, Q_PROCESSOR_MIPS_II, and Q_PROCESSOR_MIPS_III macros are also defined when Q_PROCESSOR_MIPS_IV is defined. Q_PROCESSOR_MIPS_V Defined if the application is compiled for MIPS-V processors. The Q_PROCESSOR_MIPS, Q_PROCESSOR_MIPS_I, Q_PROCESSOR_MIPS_II, Q_PROCESSOR_MIPS_III, and Q_PROCESSOR_MIPS_IV macros are also defined when Q_PROCESSOR_MIPS_V is defined. Q_PROCESSOR_POWER Defined if the application is compiled for POWER processors. Qt currently supports two Power variants: Q_PROCESSOR_POWER_32 and Q_PROCESSOR_POWER_64. Q_PROCESSOR_POWER_32 Defined if the application is compiled for 32-bit Power processors. The Q_PROCESSOR_POWER macro is also defined when Q_PROCESSOR_POWER_32 is defined. Q_PROCESSOR_POWER_64 Defined if the application is compiled for 64-bit Power processors. The Q_PROCESSOR_POWER macro is also defined when Q_PROCESSOR_POWER_64 is defined. Q_PROCESSOR_S390_X Defined if the application is compiled for S/390x processors. The Q_PROCESSOR_S390 macro is also defined when Q_PROCESSOR_S390_X is defined. Q_PROCESSOR_SH Defined if the application is compiled for SuperH processors. Qt currently supports one SuperH revision: Q_PROCESSOR_SH_4A. Q_PROCESSOR_SH_4A Defined if the application is compiled for SuperH 4A processors. The Q_PROCESSOR_SH macro is also defined when Q_PROCESSOR_SH_4A is defined. Q_PROCESSOR_SPARC Defined if the application is compiled for SPARC processors. Qt currently supports one optional SPARC revision: Q_PROCESSOR_SPARC_V9. Q_PROCESSOR_SPARC_V9 Defined if the application is compiled for SPARC V9 processors. The Q_PROCESSOR_SPARC macro is also defined when Q_PROCESSOR_SPARC_V9 is defined. Q_PROCESSOR_X86_32 Defined if the application is compiled for 32-bit x86 processors. This includes all i386, i486, i586, and i686 processors. The Q_PROCESSOR_X86 macro is also defined when Q_PROCESSOR_X86_32 is defined. Q_PROCESSOR_X86_64 Defined if the application is compiled for 64-bit x86 processors. This includes all AMD64, Intel 64, and other x86_64/x64 processors. The Q_PROCESSOR_X86 macro is also defined when Q_PROCESSOR_X86_64 is defined. quint64 Q_UINT64_C( literal) Wraps the unsigned 64-bit integer literal in a platform-independent way. Example: See also quint64 and Q_INT64_C(). Q_UNLIKELY( expr) Hints to the compiler that the enclosed condition, expr, is likely to evaluate to false. Use of this macro can help the compiler to optimize the code. Example: bool readConfiguration(const QFile &file) { // We expect to be asked to read an existing file if (Q_UNLIKELY(!file.exists())) { qWarning() << "File not found"; return false; } ... return true; } This function was introduced in QtCore 4.8. See also Q_LIKELY(). void Q_UNREACHABLE() Tells the compiler that the current point cannot be reached by any execution, so it may optimize any code paths leading here as dead code, as well as code continuing from here. This macro is useful to mark impossible conditions. For example, given the following enum: enum Shapes { Rectangle, Triangle, Circle, NumShapes }; One can write a switch table like so: switch (shape) { case Rectangle: return rectangle(); case Triangle: return triangle(); case Circle: return circle(); case NumShapes: Q_UNREACHABLE(); break; } The advantage of inserting Q_UNREACHABLE() at that point is that the compiler is told not to generate code for a shape variable containing that value. If the macro is missing, the compiler will still generate the necessary comparisons for that value. If the case label were removed, some compilers could produce a warning that some enum values were not checked. By using this macro in impossible conditions, code coverage may be improved as dead code paths may be eliminated. In debug builds the condition is enforced by an assert to facilitate debugging. This function was introduced in QtCore 5.0. See also Q_ASSERT(), Q_ASSUME(), and qFatal(). Q_UNUSED( name) Indicates to the compiler that the parameter with the specified name is not used in the body of a function. This can be used to suppress compiler warnings while allowing functions to be defined with meaningful parameter names in their signatures. foreach( variable, container) This macro is used to implement Qt's foreach loop. The variable parameter is a variable name or variable definition; the container parameter is a Qt container whose value type corresponds to the type of the variable. See The foreach Keyword for details. If you're worried about namespace pollution, you can disable this macro by adding the following line to your .pro file: CONFIG += no_keywords See also Q_FOREACH(). forever This macro is provided for convenience for writing infinite loops. Example: forever { ... } It is equivalent to for (;;). If you're worried about namespace pollution, you can disable this macro by adding the following line to your .pro file: CONFIG += no_keywords See also Q_FOREVER. qCritical(const char * message, ...) Calls the message handler with the critical message message. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger. On Blackberry the message is sent to slogger2. This function takes a format string and a list of arguments, similar to the C printf() function. The format should be a Latin-1 string. Example: void load(const QString &fileName) { QFile file(fileName); if (!file.exists()) qCritical("File '%s' does not exist!", qPrintable(fileName)); } If you include  , a more convenient syntax is also available: qCritical() << "Brush:" << myQBrush << "Other value:" << i; A space is inserted between the items, and a newline is appended at the end. To suppress the output at runtime, install your own message handler with qInstallMessageHandler(). See also qDebug(), qWarning(), qFatal(), qInstallMessageHandler(), and Debugging Techniques. qDebug(const char * message, ...) Calls the message handler with the debug message message. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the console, if it is a console application; otherwise, it is sent to the debugger. On Blackberry the message is sent to slogger2. This function does nothing if QT_NO_DEBUG_OUTPUT was defined during compilation. If you pass the function a format string and a list of arguments, it works in similar way to the C printf() function. The format should be a Latin-1 string. Example: qDebug("Items in list: %d", myList.size()); If you include  , a more convenient syntax is also available: qDebug() << "Brush:" << myQBrush << "Other value:" << i; With this syntax, the function returns a QDebug object that is configured to use the QtDebugMsg message type. It automatically puts a single space between each item, and outputs a newline at the end. It supports many C++ and Qt types. To suppress the output at run-time, install your own message handler with qInstallMessageHandler(). See also qWarning(), qCritical(), qFatal(), qInstallMessageHandler(), and Debugging Techniques. qFatal(const char * message, ...) Calls the message handler with the fatal message message. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger. On Blackberry the message is sent to slogger2. If you are using the default message handler this function will abort on Unix systems 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. This function takes a format string and a list of arguments, similar to the C printf() function. Example: int divide(int a, int b) { if (b == 0) // program error qFatal("divide: cannot divide by zero"); return a / b; } To suppress the output at runtime, install your own message handler with qInstallMessageHandler(). See also qDebug(), qCritical(), qWarning(), qInstallMessageHandler(), and Debugging Techniques. qMove( x) It expands to "std::move" if your compiler supports that C++11 function, or to nothing otherwise. const char * qPrintable(const QString & str) Returns str as a const char *. This is equivalent to str.toLocal8Bit().constData(). The char pointer will be invalid after the statement in which qPrintable() is used. This is because the array returned by toLocal8Bit() will fall out of scope. Example: qWarning("%s: %s", qPrintable(key), qPrintable(value)); See also qDebug(), qWarning(), qCritical(), and qFatal(). qWarning(const char * message, ...) Calls the message handler with the warning message message. If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger. On Blackberry the message is sent to slogger2. This function does nothing if QT_NO_WARNING_OUTPUT was defined during compilation; it exits if the environment variable QT_FATAL_WARNINGS is defined. This function takes a format string and a list of arguments, similar to the C printf() function. The format should be a Latin-1 string. Example: void f(int c) { if (c > 200) qWarning("f: bad argument, c == %d", c); } If you include  , a more convenient syntax is also available: qWarning() << "Brush:" << myQBrush << "Other value:" << i; This syntax inserts a space between each item, and appends a newline at the end. To suppress the output at runtime, install your own message handler with qInstallMessageHandler(). See also qDebug(), qCritical(), qFatal(), qInstallMessageHandler(), and Debugging Techniques.
1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 16.1 17.1 18.1 19.1 21.1 22.1 23.1 24.1 25.1 26.1 27.1 28.1 29.1 30.1 31.1 32.1 33.1 34.1 35.1 36.1 37.1 38.1 40.1 41.1 42.1 43.1 44.1 45.1 46.1 47.1 48.1 49.1 50.1 51.1 52.1 53.1 54.1 55.1 56.1 57.1 58.1 59.1 60.1 61.1 62.1 63.1 64.1 65.1 66.1 67.1 68.1 69.1 70.1 71.1 72.1 73.1 74.1 75.1 76.1 77.1 78.1 79.1 80.1 81.1 82.1 83.1 84.1 85.1 86.1 87.1 88.1 89.1 90.1 91.1 92.1 93.1 94.1 95.1 96.1 97.1 98.1 99.1 100.1 101.1 102.1 103.1 104.1 105.1 106.1 107.1 108.1 109.1 112.1 114.1 116.1 117.1 118.1 119.1 120.1 121.1 122.1 123.1 124.1 126.1 127.1 129.1 130.1 131.1 132.1 133.1 134.1 135.1 136.1 137.1 138.1 139.1 140.1 141.1 142.1 143.1 144.1 145.1 146.1 147.1 148.1 149.1 150.1 151.1 152.1 153.1 154.1 155.1 156.1 157.1 159.1 160.1 162.1 164.1 165.1 166.1 167.1 168.1 169.1 170.1 172.1 173.1 174.1 175.1 176.1 177.1 179.1 180.1 181.1 182.1 183.1 184.1 185.1 186.1 187.1 188.1 189.1 190.1 191.1 192.1 193.1 195.1 196.1 198.1 199.1 200.1 201.1 202.1 203.1 204.1 205.1 207.1 208.1 210.1 211.1 212.1 213.1 214.1 215.1 216.1 217.1 218.1 219.1 220.1 221.1 222.1 223.1 224.1 225.1 226.1 227.1 228.1 229.1 230.1 231.1 232.1 233.1 234.1 235.1 236.1 237.1 238.1 240.1 241.1 243.1 244.1 245.1 247.1 248.1 249.1 250.1 251.1 252.1 253.1 254.1 255.1 257.1 258.1 259.1 260.1 262.1 263.1 264.1 265.1 266.1 267.1
Türkçe Global Tanımlamalar Bu döküman temel C bilginiz var olduğu düşünelerek hazırlanmıştır. Orijinal ingilizce versiyona bağlı kalınmaya çalışılmış, konuların değinildiği yerlerin bir olması hedeflenmiştir. Global tanımlar   header dosyasında bulunmaktadır. Global tanım listesine bu dökümanın ingilizce versiyonundan ulaşabilirsiniz. Tipler (Types) Qt tiplerinin amacı tüm platformlarda karşılığı olan tiplerle çalışmayı sağlamaktır. Bu header dosyasında tanımlanan tipler daha çok tüm platformlarda ortak kullanılabilecek şekilde ortak bit boyutlarında değişkenleri içermektedir. Buna bir örnek verecek olursak qint8 ile 8 bit signed char garantiye alınmış olur. Bu değişken tüm platformlarda C tipinde karşılığı olan bir değişkenle Qt tarafından eşleşebilir. Bunun dışında önemli bir husus olan QtMsgType ile bir çoğu platformda Qt tarafından mesaj handlerlerine mesajlar ulaştırılarak uyumluluk sağlanmaktadır. Fonksiyonlar (Functions) başlık dosyası çeşitli fonksiyonlar taşımaktadır. Bu fonksiyonlar daha çok template amaçlıdır, yani bir çoğu platformda aynı işi gören C fonksiyonlarına kalıp olurlar. Bunlardan göze çarpan, qAbs() fonksiyonu mutlak değer döndürmektedir. qMin() ve qMax() fonksiyonları ise iki değerden en düşüğünü ve en yükseğini döndürmektedir. Örnek: - int valueA = 10; - int valueB = 5; - int valueMin = qMin(valueA, valueB); - // valueMin == 5 içerisinde dört önemli fonksiyon bulunmaktadır. Bu fonksiyonlar string mesajlar üretmektedir, qCritical(), qDebug(), qFatal() ve qWarning() dir. Örnek: - if (!driver()->isOpen() || dirver()->isOpenError()) { - qWarning("Sql Hatası: Database açılamıyor"); Örnekte görüldüğü gibi varsayım bir veritabanına bağlantı kurulduğunda hata olma ihtimali sonucu bir uyarı mesajı üretmiş olduk. Makrolar (Macros) dosyası içerisinde ki makrolardan Q_CC_ ile başlayanlar özel bir platformda compile edilmek için kullanılır. Örneğin Q_CC_SUN makrosu ile tanımlama sonucu Sun Studio C++ ile compile edilebilir. Ancak makro Q_OS_ ile başlıyor ise tanımlama belirtilen platform içindir. Örneğin Q_OS_WIN32 ile Windows sistemleri için tanımlama yapılabilir. Makrolar sayesinde derlemeye veya platforma özel kodlar geliştirilebilir. Bunun dışında çeşitli bilgiler de verilmek için bazı makrolar bulunmaktadır. Buna bir örnek olarak QT_VERSION_STR ile Qt versiyonu string olarak alınabilmektedir. Tip Dökümantasyonu typedef QtMsgHandler Bu tanımlama ile handler fonksiyonuna bir pointer oluşturulur. Bu fonksiyona parametre olarak QtMsgType ve char tipli mesaj gönderilir. - void aMsgHandler(QtMsgType, const char *); enum QtMsgType Bu enum sayesinde mesaj handlerine gönderilen mesajın tipi belirlenir. Bu sayede mesajın üretildiği kaynakta bilinmiş olur. Constant tablosu dökümanın ingilizce versiyonunda detaylıca verilmiştir. Bunlar, QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg dir. typedef qint8 Bu tanımlama signed char içindir. Bu sayede 8-bit lik data tüm platformlarda Qt tarafından desteklenmiş olur. typedef qint16 Bu tanımlama signed short içindir. Bu sayede 16-bit lik data tüm platformlarda Qt tarafından desteklenmiş olur. typedef qint32 Bu tanımlama signed int içindir. Bu sayede 32-bit lik data tüm platformlarda Qt tarafından desteklenmiş olur. typedef qint64 Bu tanımlama long long int (__int64 on Windows). Bu sayede 64-bit lik data tüm platformlarda Qt tarafından desteklenmiş olur. Ancak bunun için Q_INT64_C() makrosu kullanılmalıdır. typedef qlonglogn Bu qint64 ile aynı yapıya sahiptir. typedef qptrdiff Bu değişken tipi pointer farklılıkları için kullanılmaktadır. Bu sayede herhangi bir boyutta ki pointer tüm platformlarda desteklenebilmektedir. Burada qptrdiff signed dir, signed olmayan değerler için quintptr kullanmanız gerekir. typedef qreal Bu değişken tipi double içindir. Ancak ARM işlemcilerde bu değişken float olarak karşılık alır. Bunun sebebi performans kazanmak içindir. typedef quint8 Bu değişken unsigned char içindir. typedef quint16 Bu değişken unsigned short içindir. typedef quint32 Bu değişken unsigned int içindir. typedef quint64 Bu değişken unsigned long long int (unsigned __int64 Windows’da) içindir. Bu değişkeni kullanmak için Q_UINT64_C() makrosu kullanılmalıdır. typedef quintptr Bu değişken unsigned pointer farklılığı içindir. Bu sayede herhangi bir boyuttaki unsigned pointerlar Qt tarafından farklı platformlarda desteklenmektedir. typedef qulonglong Bu değişken quintptr ile aynıdır. typedef uchar unsigned char için en kolay uyuşumlu tiptir. typedef uint unsigned int için en kolay uyuşumlu tiptir. typedef ulong unsigned long için en kolay uyuşumlu tiptir. typedef ushort unsigned short için en kolay uyuşumlu tiptir. Fonkisyon Dökümantasyonu T qAbs(const T & value) qAbs fonksiyonu T tipi ile verilen değeri 0 dan uzaklaştırarak mutlak değerini alır. Örnek: - int mutlakDeger; - int orijinalDeger = -14; - mutlakDeger = qAbs(orijinalDeger); - // mutlakDeger == 14 const T & qBound( const T & min, const T & value, const T & max ) Bir değeri en düşük ve en yüksek sınırlarda ki bir aralıkta tutacak şekilde zorlar. Bu qMax(min, qMin(value, max)) ile aynıdır. Örnek: - int xValue = 0; - int minValue = 2; - int maxValue = 8; - int boundedValue = qBound(minValue, xValue, maxValue); - // boundedValue == 2 void qCritical ( const char * msg, … ) Mesaj handlerini critical mesajla çağırır. Eğer mesaj handleri tanımlanmamışsa stderr hatayı yazdırır. Windows altında mesaj debuggere gönderilir. Bu fonksiyon C printf() fonksiyonundaki gibi string argümanlarını kabul etmektedir. Örnek: void qDebug ( const char * msg, … ) Mesaj handlerini debug mesajla çağırır. Eğer mesaj handleri tanımlanmamışsa stderr hatayı yazdırır. Windows altında console uygulaması geliştirildiğinde mesaj debuggere gönderilir. Eğer QT_NO_DEBUG_OUTPUT tanımlaması yapılmış ise mesaj esgeçilir. Bu fonksiyon C printf() fonksiyonundaki gibi string argümanlarını kabul etmektedir. void qFatal ( const char * msg, … ) Mesaj handlerini fatal mesajla çağırır. Eğer mesaj handleri tanımlanmamışsa stderr hatayı yazdırır. Windows altında mesaj debuggere gönderilir. bool qFuzzyCompare ( double p1, double p2 ) [static] Floating point p1 ve p2 değerlerini eşitliğini kontrol ederek eşit olma durumunda true yanlış olma durumunda false döndürmektedir. Burada dikkat edilmesi gereken bir bug bulunduğu bildirilmiştir. Bu kontrol eğer 0.0 değerleri üzerinde yapılacak ise çalışmayacaktır. Bunun için yapılablecek bir çözüm olarak compare edilecek her iki değere 1 eklenerek sorun giderilmiş olur. bool qFuzzyCompare ( float p1, float p2 ) [static] qFuzzyCompare nin double parametrelisi ile aynıdır. QtMsgHandler qInstallMsgHandler ( QtMsgHandler handler ) Daha onceden tanimlanmis olan bir mesaj handleri install ederek pointerini geri dondurur. Mesaj handleri qFatal, qDebug gibi mesajlari yakalayarak mesaj ciktilarinnin olusturulmasini saglar. Eger QT_NO_WARNING_OUTPUT ve/veya QT_NO_DEBUG_OUTPUT tanimlanmamissa bu mesajlar in ciktilarini almak mumkun olur Mesaj handleri mesajlari X11 altinda standart outputtan verirken Windows altinda ise debugtan vermektedir. Fatal mesajlarinin onemli bir hususuda uygulamayi durdurmasidir. int qMacVersion() Bunun yerine QSysInfo::MacintoshVersion kullanmanız tavsiye edilir. const T & qMax ( const T & value1, const T & value2 ) value1 ve value2 değerlerinden en büyüğünü getirir. Örnek: - int benimVeri = 10; - int seninVeri = 5; - int enBuyukKim = qMax(benimVeri, seninVeri); - // enBuyukKim == benimVeri const T & qMin ( const T & value1, const T & value2 ) qMax dakinin aksine en küçük değeri döndürür. Bir önceki örnekte uygulandığında enBuyukKim değişkeni seninVeri ye eşit olacaktır. qint64 qRound64 ( qreal value ) 64-bit integer olacak şekilde sayıyı yuvarlayıp döndürür. Örnek: - int roundedDeger1 = qRound(deger1); - int roundedDeger2 = qRound(deger2); int qRound ( qreal value ) Integer tipinde bir sayıyı yuvarlayıp döndürür. Bir önceki örnekteki gibi davranış sergiler. const char * qVersion () Çalışma esnasında qt nin versiyonunu öğrenmek isterseniz bu fonksiyonla String tipinde versiyonu alabilirsiniz (Örneğin, “4.1.0”). Ayrıca QT_VERSION_STR makrosuna da bakınız. void qWarning ( const char * msg, … ) Mesaj handlerini msg bilgisiyle çağırır. Eğer mesaj handleri oluşturulmamışsa hata çıktısını stderr’a yönlendirir. Windows altında çalışıyorsanız mesajı debugger’e gönderecektir. Eğer bu fonksiyon QT_NO_WARNING_OUTPUT ile karşılaşmamışsa, QT_FATAL_WARNING tanımlaması yapacaktır. QT_NO_WARNING_OUTPUT tanımlaması sayesinde Warning tipi hataları es geçebildiğimizi unutmayın. Bu fonksiyon string formatını ve liste argüman yapısını C de ki printf() fonksiyonunda olduğu gibi kullanabilmektedir. Örnek: - void f(int c) - if ( c > 500 ) - qWarning("f: bad argument, c == %d", c); Eğer program çalışırken süpriz bir çıktıyla karşılaşmak istemiyorsanız tavsiye qInstallMsgHandler() ‘i install etmektir. T * q_check_ptr ( T * pointer ) Pek fazla açıklama bulamadığım bir husus. Ama anladığım kadarıyla pointerin pointer olup olmadığını denetliyor. Bir pointer verin ve size yine bir pointer döndürsün. Pointer vermezseniz ne olur, zaten onu denetlemek için. QByteArray qgetenv ( const char * varName ) Environment değişkenlerini okumaya ihtiyaç duyduğunuzda parametrede göndereceğiniz değeri okur. Gelen dğeri QByteArray::constData() fonksiyonuyla char dönüştürebilirsiniz. bool qputenv ( const char * varName, const QByteArray & value ) Environment değişkenlerinde düzenleme veya ekleme ihtiyacı duyduğunuzda bu fonksiyonu kullanabilirsiniz. Değişkenin adı ve değerini göndererek var ise eski kaydı günceller, yok ise yeni kayıt oluşturur. Eğer geri dönen değer 0 ise değeri ayarlamayı maalesef yapamamış demektir. int qrand () C++ da ki rand() fonksiyonunun Thread-safe versiyonudur. Geri döndereceği sayıyı 0 ile RAND_MAX (bu max   ve   dosyalarında tanımlanmıştır) arasında pseudo-random sekansı ile bularak döndürür. Bu sekans bir adım değeri ile üretildiği için eğer adım değerini belirleyerek rastgele sayı üretmek isterseniz qsrand() fonskiyonunu kullanabilirsiniz. void qsrand ( uint seed ) C++ da ki srand() fonksiyonun Thread-safe versiyonudur. qrand() fonksiyonunu çağırırken, pseudo rastgele sayısını üretecek adım değerini belirtmek için kullanılır. Yani rastgele sayı aralığında ki sekansı değiştirmeye yarar. qsrand() fonskiyonu ile tanımlanan adım değeri bir thread boyunca hep aynı kalacaktır. Buna dikkat ederek farklı threadlarda sekansın aynı ayarla olmayacağını ve bir thread boyunca sekansın değişmesini istiyorsanız thread bitmeden tekrar ayarlamanız gerekeceğini unutmayın. void qt_set_sequence_auto_mnemonic ( bool on ) Mac sistemlerde mnemonic değerini aktif etmeye yarar. Mac sistemlerde bu değer varsayılan olarak false dır. int qt_symbian_exception2Error ( const std::exception & aThrow ) Symbian sistemlerde C++ standart hatalarını symbian hata sisteminde symbian hata koduna dönüştürmeyi sağlar. Bu kod sadece symbian sistemlerde çalışır. void qt_symbian_exception2LeaveL ( const std::exception & aThrow ) Symbian sistemlerde C++ standart hatalarını symbian hata sisteminde symbian leave haline dönüştürmeyi sağlar. Bu kod sadece symbian sistemlerde çalışır. void qt_symbian_throwIfError ( int error ) Symbian sistemlerde hata kodu ile hata fırlatılmasını sağlar. Bu kod sadece symbian sistemlerde çalışır. Makro Dökümantasyonu QT_REQUIRE_VERSION ( int argc, char ** argv, const char * version ) Qt uygulaması geliştirirken gerekli versiyonu belirtmek için kullanılır. Bu sayede uygulama çalışmadan önce gerekli versiyonun var olup olmadığını kontrol ederek uygulamanın çalışmasını sağlar. argc ve argv parametreleri qt main fonksiyonuna gönderilen parametreler olmalıdır. Örnek: - #include - #include - int main(int argc, char *argv[]) - QT_REQUIRE_VERSION(argc, argv, "4.0.2") - QApplication app(argc, argv); - return app.exec(); QT_TRYCATCH_ERROR ( error, function ) Bu makro standart C++ hata kodunu yakalayıp Symbian OS hata koduna dönüştürür. Bu durumda error ile kodu ve KErrNone ile hata oluşmadığı bilgilerine ulaşabiliriz. Bu makro sadece Symbian sistemlerde çalışır. Örnek: - // Burada Symbian TInt tipinde hata kodunu üreterek bize sunar. - // Örnekte server adını translate ederken oluşacak hatayı algılamaya çalışılmıştır. - // Eğer hata olursa geri dönecek değer KErrNone sabitinden farklı olacaktır. - TInt QServerApp::Connect(const QString &serverName) - TPtrC name; - TInt err; - QT_TRYCATCH_ERROR(err, name.Set(qt_QString2TPtrC(serverName))); - if (err != KErrNone) - return err; - return iServer.Connect(name); QT_VERSION Qt nin versiyonunu hex olarak verir. Bu 0xMMNNPP şeklindeki (MM=Major, NN=Minor ve PP=Patch) bilgiyle version bilgisine ulaşılabilinir. Aşağıda ki örnekte qt versiyonuna göre uygulamada derlenirken icon atama yöntemine değinilmiştir. Örnek: - #if QT_VERSION >= 0x040100 - #else - QIcon icon(pixmap); - #endif QT_VERSION_STR String tipinde (örn: 4.1.0) versiyon bilgisini almamıza yarar. void Q_ASSERT ( bool test ) Bir işlem sonucunda debug modunda iken bize işlem için test yaparak bilgi gönderir. Bu bilgi kaynak, satır gibi verilerle debug çıktısına basılır. Örnek: - // File: div.cpp - #include - int divide(int a, int b) - Q_ASSERT(b != 0); - return a / b; Örnekte eğer b değeri 0 verilerek çağrılmış ise debug çıktısına aşağıdaki gibi bir bilgi yazılacaktır. - ASSERT: "b == 0" in file div.cpp, line 7 void Q_ASSERT_X ( bool test, const char * where, const char * what ) Q_ASSERT den farklı olarak nerede ve ne bilgileri de mesaj olarak gönderilir. Örnek: - // File: div.cpp - #include - int divide(int a, int b) - Q_ASSERT_X(b != 0, "Bölme işlemi", "Sıfıra bölme hatası"); - return a / b; Eğer işlemde b 0 olarak gönderilmiş ise debug çıktısına aşağıda ki bilgi düşecektir. - ASSERT failure in Bölme işlemi: "Sıfıra bölme hatası", file div.cpp, line 7 Q_CC_BOR Bu tanımlama ile derlemenin Borland/Turbo C++ ile yapılacağını belirtir. Q_CC_CDS Bu tanımlama ile derlemenin Reliend C++ ile yapılacağını belirtir. Q_CC_COMEAU Bu tanımlama ile derlemenin Comeau C++ ile yapılacağını belirtir. Q_CC_DEC Bu tanımlama ile derlemenin DEC C++ ile yapılacağını belirtir. Q_CC_EDG Bu tanımlama ile derlemenin Eddison Design Group C++ ile yapılacağını belirtir. Q_CC_GHS Bu tanımlama ile derlemenin Green Hills Optimizing C++ ile yapılacağını belirtir. Q_CC_GNU Bu tanımlama ile derlemenin GNU C++ ile yapılacağını belirtir. Q_CC_INTEL Bu tanımlama ile derlemenin Intel C++ ile yapılacağını belirtir. Q_CC_MSVC Bu tanımlama ile derlemenin Microsoft Visual C/C++ veya Intel C++ for Windows ile yapılacağını belirtir. void Q_CHECK_PTR ( void * pointer ) Parametrenin pointer olup olmadığını kontrol eder. Q_DECLARE_TYPEINFO ( Type, Flags ) Özellikle bir tip için ekstra bilgi ataması yapmak istediğinizde kullanabilirsiniz. Type ile belirteceğiniz tipe Flag ile özellik bilgisini eklersiniz. Bu özelikler; - Q_PRIMITIVE_TYPE ile kurucusu ve yıkıcısı olmayan tiplere ait flagdır. Genellikle POD (plain old data) diye anılırlar. - Q_MOVABLE_TYPE ile kurucusu ve/veya yıkıcısı olan bellekte taşınabilir (memcopy() ile) tiplerin flagıdır. - Q_COMPLEX_TYPE (varsayılan) kurucusu ve/veya yıkıcısı olan ancak bellekte taşınamayn tiplerin flagıdır. Primitif bir tip için örnek: - struct Point2D - int x; - int y; - Q_DECLARE_TYPEINFO(Point2D, Q_PRIMITIVE_TYPE); Movable bir tip için örnek: - class Point2D - public: - Point2D() { data = new int[2]; } - Point2D(const Point2D &other) { ... } - ~Point2D() { delete[] data; } - Point2D &operator=(const Point2D &other) { ... } - int x() const { return data[0]; } - int y() const { return data[1]; } - private: - int *data; - Q_DECLARE_TYPEINFO(Point2D, Q_MOVABLE_TYPE); qint64 Q_INT64_C ( literal ) Platformdan bağımsız olarak signed int64 oluşturmaya yarar. Örnek: foreach ( variable, container ) container üzerinden değer çekerek çalışan standart foreach döngüsüdür. forever for (;;) döngüsünde olduğu gibi sonsuz döngü oluşturmaya yarar süslü parantezler içerisini sürekli çalıştırır. Son Bu makale ingilizce versiyonunda ki konular alınarak hazırlanmıştır. Bazı konular atlanmış olabilir, bu genellikle aynı yapıdaki sabitler, makrolar ve fonksiyonlarda olabilir. Lütfen eksik konular için ingilizce versiyonuna başvurunuz.