<QtGlobal> - Global Qt Declarations
The <QtGlobal> header file includes the fundamental global declarations. It is included by most other Qt header files. More...
Types
| typedef | QFunctionPointer |
| typedef | QtMessageHandler |
| enum | QtMsgType { QtDebugMsg, QtInfoMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg } |
| 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
| T | qAbs(const T &value) |
| QtPrivate::QAddConst<T>::Type & | qAsConst(T &t) |
| const T & | qBound(const T &min, const T &value, const T &max) |
| auto | qConstOverload(T memberFunctionPointer) |
| int | qEnvironmentVariableIntValue(const char *varName, bool *ok = Q_NULLPTR) |
| bool | qEnvironmentVariableIsEmpty(const char *varName) |
| bool | qEnvironmentVariableIsSet(const char *varName) |
| quint32 | qFloatDistance(float a, float b) |
| quint64 | qFloatDistance(double a, double b) |
| QString | qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, const QString &str) |
| bool | qFuzzyCompare(double p1, double p2) |
| bool | qFuzzyCompare(float p1, float p2) |
| bool | qFuzzyIsNull(double d) |
| bool | qFuzzyIsNull(float f) |
| double | qInf() |
| QtMessageHandler | qInstallMessageHandler(QtMessageHandler handler) |
| bool | qIsFinite(double d) |
| bool | qIsFinite(float f) |
| bool | qIsInf(double d) |
| bool | qIsInf(float f) |
| bool | qIsNaN(double d) |
| bool | qIsNaN(float f) |
| const T & | qMax(const T &value1, const T &value2) |
| const T & | qMin(const T &value1, const T &value2) |
| auto | qNonConstOverload(T memberFunctionPointer) |
| auto | qOverload(T functionPointer) |
| double | qQNaN() |
| qint64 | qRound64(double value) |
| qint64 | qRound64(float value) |
| int | qRound(double value) |
| int | qRound(float value) |
| double | qSNaN() |
| void | qSetMessagePattern(const QString &pattern) |
| const char * | qVersion() |
| T * | q_check_ptr(T *pointer) |
| QByteArray | qgetenv(const char *varName) |
| bool | qputenv(const char *varName, const QByteArray &value) |
| int | qrand() |
| void | qsrand(uint seed) |
| QString | qtTrId(const char *id, int n = -1) |
| bool | qunsetenv(const char *varName) |
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 <QtGlobal> 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
<QtGlobal> also contains functions that generate messages from the given string argument: qDebug(), qInfo(), qWarning(), qCritical(), and qFatal(). These functions call the message handler with the given message.
Example:
if (!driver()->isOpen() || driver()->isOpenError()) { qWarning("QSqlQuery::exec: database not open"); return false; }
The remaining functions are qRound() and qRound64(), which both accept a double
or float
value as their argument returning the value rounded up to the nearest integer and 64-bit integer respectively, the qInstallMessageHandler() function which installs the given QtMessageHandler, and the qVersion() function which returns the version number of Qt at run-time as a string.
Macros
The <QtGlobal> 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.
See also <QtAlgorithms> 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 Qt 5.0.
See also QtMsgType and qInstallMessageHandler().
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.
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:
qint64 value = Q_INT64_C(932838457459459);
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
unless Qt is configured with the -qreal float
option.
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:
quint64 value = Q_UINT64_C(932838457459459);
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
QtPrivate::QAddConst<T>::Type &qAsConst(T &t)
Returns t cast to const 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:
QString s = ...; for (QChar ch : s) // detaches 's' (performs a deep-copy if 's' was shared) process(ch); for (QChar ch : qAsConst(s)) // ok, no detach attempt process(ch);
Of course, in this case, you could (and probably should) have declared s
as const
in the first place:
const QString s = ...; for (QChar ch : s) // ok, no detach attempt on const objects process(ch);
but often that is not easily possible.
It is important to note that qAsConst() does not copy its argument, it just performs a const_cast<const T&>(t)
. This is also the reason why it is designed to fail for rvalues: The returned reference would go stale too soon. So while this works (but detaches the returned object):
for (QChar ch : funcReturningQString()) process(ch); // OK, the returned object is kept alive for the loop's duration
this would not:
for (QChar ch : qAsConst(funcReturningQString())) process(ch); // ERROR: ch is copied from deleted memory
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)).
Example:
int myValue = 10; int minValue = 2; int maxValue = 6; int boundedValue = qBound(minValue, myValue, maxValue); // boundedValue == 6
auto qConstOverload(T memberFunctionPointer)
Returns the memberFunctionPointer pointer to a constant member function:
struct Foo { void overloadedFunction(int, QString); void overloadedFunction(int, QString) const; }; ... qConstOverload<>(&Foo::overloadedFunction) ... qNonConstOverload<int, QString>(&Foo::overloadedFunction)
This function was introduced in Qt 5.7.
See also qOverload, qNonConstOverload, and Differences between String-Based and Functor-Based Connections.
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.
Equivalent to
qgetenv(varName).toInt(ok, 0)
except that it's much faster, and can't throw exceptions.
Note: there's a limit on the length of the value, which is sufficient for all valid values of int, not counting leading zeroes or spaces. Values that are too long will either be truncated or this function will set ok to false
.
This function was introduced in Qt 5.5.
See also qgetenv() and qEnvironmentVariableIsSet().
bool qEnvironmentVariableIsEmpty(const char *varName)
Returns whether the environment variable varName is empty.
Equivalent to
qgetenv(varName).isEmpty()
except that it's potentially much faster, and can't throw exceptions.
This function was introduced in Qt 5.1.
See also qgetenv() and qEnvironmentVariableIsSet().
bool qEnvironmentVariableIsSet(const char *varName)
Returns whether the environment variable varName is set.
Equivalent to
!qgetenv(varName).isNull()
except that it's potentially much faster, and can't throw exceptions.
This function was introduced in Qt 5.1.
See also qgetenv() and qEnvironmentVariableIsEmpty().
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.
This function is useful if a floating point comparison requires a certain precision. Therefore, if a and b are equal it will return 0. The maximum value it will return for 32-bit floating point numbers is 4,278,190,078. This is the distance between -FLT_MAX
and +FLT_MAX
.
The function does not give meaningful results if any of the arguments are Infinite
or NaN
. You can check for this by calling qIsFinite().
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:
if (qFloatDistance(a, b) < (1 << 7)) { // The last 7 bits are not // significant // precise enough }
This function was introduced in Qt 5.2.
See also qFuzzyCompare().
quint64 qFloatDistance(double a, double b)
Returns the number of representable floating-point numbers between a and b.
This function serves the same purpose as qFloatDistance(float, float)
, but returns the distance between two double
numbers. Since the range is larger than for two float
numbers ([-DBL_MAX,DBL_MAX]
), the return type is quint64.
This function was introduced in Qt 5.2.
See also qFuzzyCompare().
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.
See also qInstallMessageHandler() and qSetMessagePattern().
[static]
bool qFuzzyCompare(double p1, double p2)
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, nor does comparing values where one of the values is NaN or infinity. If one of the values is always 0.0, use qFuzzyIsNull instead. If one of the values is likely to be 0.0, one solution is to add 1.0 to both values.
// 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 Qt 4.4.
[static]
bool qFuzzyCompare(float p1, float p2)
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 Qt 4.4.
[static]
bool qFuzzyIsNull(double d)
Returns true if the absolute value of d is within 0.000000000001 of 0.0.
Note: This function is thread-safe
This function was introduced in Qt 4.4.
[static]
bool qFuzzyIsNull(float f)
Returns true if the absolute value of f is within 0.00001f of 0.0.
Note: This function is thread-safe
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.
To restore the message handler, call qInstallMessageHandler(0)
.
Example:
#include <qapplication.h> #include <stdio.h> #include <stdlib.h> 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 QtInfoMsg: fprintf(stderr, "Info: %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 Qt 5.0.
See also QtMessageHandler, QtMsgType, qDebug(), qInfo(), qWarning(), qCritical(), qFatal(), and Debugging Techniques.
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
auto qNonConstOverload(T memberFunctionPointer)
Returns the memberFunctionPointer pointer to a non-constant member function:
struct Foo { void overloadedFunction(int, QString); void overloadedFunction(int, QString) const; }; ... qConstOverload<>(&Foo::overloadedFunction) ... qNonConstOverload<int, QString>(&Foo::overloadedFunction)
This function was introduced in Qt 5.7.
See also qOverload, qNonConstOverload, and Differences between String-Based and Functor-Based Connections.
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:
struct Foo { void overloadedFunction(); void overloadedFunction(int, QString); }; ... qOverload<>(&Foo::overloadedFunction) ... qOverload<int, QString>(&Foo::overloadedFunction)
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:
... QOverload<>::of(&Foo::overloadedFunction) ... QOverload<int, QString>::of(&Foo::overloadedFunction)
This function was introduced in Qt 5.7.
See also qConstOverload(), qNonConstOverload(), and Differences between String-Based and Functor-Based Connections.
double qQNaN()
Returns the bit pattern of a quiet NaN as a double.
qint64 qRound64(double value)
Rounds value to the nearest 64-bit integer.
Example:
double valueA =<PHONE_NUMBER>0.3; double valueB =<PHONE_NUMBER>0.7; qint64 roundedValueA = qRound64(valueA); // roundedValueA =<PHONE_NUMBER>0 qint64 roundedValueB = qRound64(valueB); // roundedValueB =<PHONE_NUMBER>1
qint64 qRound64(float value)
Rounds value to the nearest 64-bit integer.
Example:
float valueA =<PHONE_NUMBER>0.3; float valueB =<PHONE_NUMBER>0.7; qint64 roundedValueA = qRound64(valueA); // roundedValueA =<PHONE_NUMBER>0 qint64 roundedValueB = qRound64(valueB); // roundedValueB =<PHONE_NUMBER>1
int qRound(double value)
Rounds value to the nearest integer.
Example:
double valueA = 2.3; double valueB = 2.7; int roundedValueA = qRound(valueA); // roundedValueA = 2 int roundedValueB = qRound(valueB); // roundedValueB = 3
int qRound(float value)
Rounds value to the nearest integer.
Example:
float valueA = 2.3; float 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(), qInfo(), qWarning(), qCritical(), and qFatal(). The category logging output of qCDebug(), qCInfo(), qCWarning(), and qCCritical() is formatted, too.
Following placeholders are supported:
| Placeholder | Description |
|---|---|
%{appname} | QCoreApplication::applicationName() |
%{category} | Logging category |
%{file} | Path to source file |
%{function} | Function |
%{line} | Line in source file |
%{message} | The actual message |
%{pid} | QCoreApplication::applicationPid() |
%{threadid} | The system-wide ID of current thread (if it can be obtained) |
%{qthreadptr} | A pointer to the current QThread (result of QThread::currentThread()) |
%{type} | "debug", "warning", "critical" or "fatal" |
%{time process} | time of the message, in seconds since the process started (the token "process" is literal) |
%{time boot} | the time of the message, in seconds since the system boot if that can be determined (the token "boot" is literal). If the time since boot could not be obtained, the output is indeterminate (see QElapsedTimer::msecsSinceReference()). |
%{time [format]} | system time when the message occurred, formatted by passing the format to QDateTime::toString(). If the format is not specified, the format of Qt::ISODate is used. |
%{backtrace [depth=N] [separator="..."]} | A backtrace with the number of frames specified by the optional depth parameter (defaults to 5), and separated by the optional separator parameter (defaults to "|"). This expansion is available only on some platforms (currently only platfoms using glibc). Names are only known for exported functions. If you want to see the name of every function in your application, use QMAKE_LFLAGS += -rdynamic . When reading backtraces, take into account that frames might be missing due to inlining or tail call optimization. |
You can also use conditionals on the type of the message using %{if-debug}
, %{if-info}
%{if-warning}
, %{if-critical}
or %{if-fatal}
followed by an %{endif}
. What is inside the %{if-*}
and %{endif}
will only be printed if the type matches.
Finally, text inside %{if-category}
... %{endif}
is only printed if the category is not the default one.
Example:
QT_MESSAGE_PATTERN="[%{time yyyyMMdd h:mm:ss.zzz t} %{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{file}:%{line} - %{message}"
The default pattern is "%{if-category}%{category}: %{endif}%{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.
Custom message handlers can use qFormatLogMessage() to take pattern into account.
This function was introduced in Qt 5.0.
See also qInstallMessageHandler(), Debugging Techniques, and QLoggingCategory.
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 and QLibraryInfo::version().
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(). To convert the data to a QString use QString::fromLocal8Bit().
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.
Warning: Don't use qgetenv on Windows if the content may contain non-US-ASCII characters, like file paths.
See also qputenv(), qEnvironmentVariableIsSet(), and qEnvironmentVariableIsEmpty().
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.
See also qgetenv().
int qrand()
Thread-safe version of the standard C++ rand()
function.
Returns a value between 0 and RAND_MAX
(defined in <cstdlib>
and <stdlib.h>
), 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.
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 call qrand(), the threads will get the same random number sequence.
This function was introduced in Qt 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:
//% <C string>
or
\begincomment% <C string> \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 Qt 4.6.
See also QObject::tr(), QCoreApplication::translate(), and Internationalization with Qt.
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.
See also qputenv() and qgetenv().
Macro Documentation
QT_DEPRECATED_WARNINGS
If this macro is defined, the compiler will generate warnings if API declared as deprecated by Qt is used.
See also QT_DISABLE_DEPRECATED_BEFORE.
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
See also QT_DEPRECATED_WARNINGS.
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 <QApplication> #include <QMessageBox> 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 Qt 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 Qt 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 <QtGlobal> #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include <QtWidgets> #else #include <QtGui> #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 <QtGlobal> 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 <QtGlobal> 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 Qt 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_CLANG
Defined if the application is compiled using Clang.
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.
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 usingmemcpy()
. Note: despite the name, this has nothing to do with move constructors or C++ move semantics.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.
See also Q_DECL_RELAXED_CONSTEXPR.
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 Qt 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 Qt 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 Qt 5.0.
See also Q_DECL_NOTHROW and Q_DECL_NOEXCEPT.
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.
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 Qt 5.0.
See also Q_DECL_FINAL.
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.
See also Q_DECL_CONSTEXPR.
void Q_FALLTHROUGH()
Can be used in switch statements at the end of case block to tell the compiler and other developers that that the lack of a break statement is intentional.
This is useful since a missing break statement is often a bug, and some compilers can be configured to emit warnings when one is not found.
This function was introduced in Qt 5.8.
See also Q_UNREACHABLE().
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.
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.
See also qAsConst().
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().
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:
template<typename TInputType> 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:
qint64 value = Q_INT64_C(932838457459459);
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 Qt 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_ANDROID
Defined on Android.
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-based operating systems such as macOS, iOS, watchOS, and tvOS.
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_IOS
Defined on iOS.
Q_OS_IRIX
Defined on SGI Irix.
Q_OS_LINUX
Defined on Linux.
Q_OS_LYNX
Defined on LynxOS.
Q_OS_MAC
Deprecated synonym for Q_OS_DARWIN
. Do not use.
Q_OS_MACOS
Defined on macOS.
Q_OS_NETBSD
Defined on NetBSD.
Q_OS_OPENBSD
Defined on OpenBSD.
Q_OS_OSF
Defined on HP Tru64 UNIX.
Q_OS_OSX
Deprecated synonym for Q_OS_MACOS
. Do not use.
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_TVOS
Defined on tvOS.
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_WATCHOS
Defined on watchOS.
Q_OS_WIN32
Defined on 32-bit and 64-bit versions of Windows.
Q_OS_WIN64
Defined on 64-bit versions of Windows.
Q_OS_WIN
Defined on all supported versions of Windows. That is, if Q_OS_WIN32, Q_OS_WIN64, or Q_OS_WINRT is defined.
Q_OS_WINRT
Defined for Windows Runtime (Windows Store apps) on Windows 8, Windows RT, and Windows Phone 8.
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
Q_PROCESSOR_ALPHA
Defined if the application is compiled for Alpha processors.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
Q_PROCESSOR_AVR32
Defined if the application is compiled for AVR32 processors.
See also QSysInfo::buildCpuArchitecture().
Q_PROCESSOR_BLACKFIN
Defined if the application is compiled for Blackfin processors.
See also QSysInfo::buildCpuArchitecture().
Q_PROCESSOR_IA64
Defined if the application is compiled for IA-64 processors. This includes all Itanium and Itanium 2 processors.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
Q_PROCESSOR_SH
Defined if the application is compiled for SuperH processors. Qt currently supports one SuperH revision: Q_PROCESSOR_SH_4A.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
Q_PROCESSOR_SPARC
Defined if the application is compiled for SPARC processors. Qt currently supports one optional SPARC revision: Q_PROCESSOR_SPARC_V9.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
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.
See also QSysInfo::buildCpuArchitecture().
quint64 Q_UINT64_C(literal)
Wraps the unsigned 64-bit integer literal in a platform-independent way.
Example:
quint64 value = Q_UINT64_C(932838457459459);
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 Qt 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 Qt 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
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.
See also qAsConst().
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 QNX the message is sent to slogger2
It exits if the environment variable QT_FATAL_CRITICALS is not empty.
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!", qUtf8Printable(fileName)); }
If you include <QtDebug>, 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(), qInfo(), 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 QNX, 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 <QtDebug>
, 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 qInfo(), 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 QNX the message is sent to slogger2
If you are using the default message handler this function will abort to create a core dump. On Windows, for debug builds, this function will report a _CRT_ERROR enabling you to connect a debugger to the application.
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(), qInfo(), qWarning(), qCritical(), qInstallMessageHandler(), and Debugging Techniques.
qInfo(const char *message, ...)
Calls the message handler with the informational 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 QNX the message is sent to slogger2. This function does nothing if QT_NO_INFO_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:
qInfo("Items in list: %d", myList.size());
If you include <QtDebug>
, a more convenient syntax is also available:
qInfo() << "Brush:" << myQBrush << "Other value:" << i;
With this syntax, the function returns a QDebug object that is configured to use the QtInfoMsg 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().
This function was introduced in Qt 5.5.
See also qDebug(), qWarning(), qCritical(), qFatal(), qInstallMessageHandler(), and Debugging Techniques.
qMove(x)
It expands to "std::move" if your compiler supports that C++11 function, or to nothing otherwise.
qMove takes an rvalue reference to its parameter x, and converts it to an xvalue.
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 QString::toLocal8Bit() will fall out of scope.
Note: qDebug(), qInfo(), qWarning(), qCritical(), qFatal() expect %s arguments to be UTF-8 encoded, while qPrintable() converts to local 8-bit encoding. Therefore qUtf8Printable() should be used for logging strings instead of qPrintable().
See also qUtf8Printable().
const wchar_t *qUtf16Printable(const QString &str)
Returns str as a const ushort *
, but cast to a const wchar_t *
to avoid warnings. This is equivalent to str.utf16() plus some casting.
The only useful thing you can do with the return value of this macro is to pass it to QString::asprintf() for use in a %ls
conversion. In particular, the return value is not a valid const wchar_t*
!
In general, the pointer will be invalid after the statement in which qUtf16Printable() is used. This is because the pointer may have been obtained from a temporary expression, which will fall out of scope.
Example:
qWarning("%ls: %ls", qUtf16Printable(key), qUtf16Printable(value));
This function was introduced in Qt 5.7.
See also qPrintable(), qDebug(), qInfo(), qWarning(), qCritical(), and qFatal().
const char *qUtf8Printable(const QString &str)
Returns str as a const char *
. This is equivalent to str.toUtf8().constData().
The char pointer will be invalid after the statement in which qUtf8Printable() is used. This is because the array returned by QString::toUtf8() will fall out of scope.
Example:
qWarning("%s: %s", qUtf8Printable(key), qUtf8Printable(value));
This function was introduced in Qt 5.4.
See also qPrintable(), qDebug(), qInfo(), 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 QNX 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 not empty.
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 <QtDebug>, 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(), qInfo(), qCritical(), qFatal(), qInstallMessageHandler(), and Debugging Techniques.


sign up | password reset
log in | password reset
Reported material will not be automatically redacted. It is sent to an administrator for review.
Share deck on: facebook | LinkedIn
60 seconds between changes
background photo by Alex Litvin on Unsplash


3D Printer
Rotation 5 is based on 3D printing and scanning. That's why I'm going to give a quick introduction to what are
your possibilities with 3D printers.
3D printers have the awesome capacity of being able to create (almost) anything you can come to mind with and makeing tests.
The only limitations to 3D printing are the size and the precission, obviously the file you are trieing to print can't be
bigger than the 3D printer itself and it can't be too small either because every 3D printer has a level of precission,
wich is the size height that each printed layer has. There are different types of 3D printers, we have the classic FDM wich
stands for Fusion Deposition Modeling, and the more advanced SLA with stands for Stereolithography. FDM works by melting material,
while SLA works by hardening resine with lasers. Our school has 5 MakerBot's 5th Gen, one FormLabs (SLA) 3D printer
and one RepRap X400 3D Printer.
Bust
Rotation 5 started with 3D scanning our upper boddies to create a Bust of ourselves that would be
3D printed with the resine laser 3D printer.
Making the bust wasn't as hard as I thought it would be. I just joinded both "stl" files in meshmixer and
then exported it. Meshmixer gave me some trouble because it didn't want to export my file but after time and patience,
it did export it.
Theese are the files that correspond to the bust:
Column
Body
MeshMixer File
Full Bust
3D Object that can't be made subtractevely
The next project was making an object that can't be made subtractevely. I decided to make a box that
has a cross on the top, making it really hard to make subtractevely.
This is the file used:
Shape STL
Shape MAKERBOT
Irrigation System
The next project was making a Drip Irrigation System. Although this was a group project, my parner wasn't here
so I ended up doing it by myself.
These are images of different tries I went through. In the first image, the weight was to big on the
top so it fell and the printer kept printing on thin air. The second try printed perfectly but it was
half a millimeter too small and it didn't fit. Finally, I was able to make one that fits the bottle and work.
Files I've used:
Fail 1
Fail 2
Success!!!


Dimitar Germanov
I Love
Projects
Weather App
At The Wall
Rock, Paper, Scissors
Relax App
Recipe App
Calculator


Transaction
Acknowledgment
https://example.com
Account Address
NULSd6HgTwme2Q...
|
Method Name |
Transaction Fee Calculating... |
Only allow sites you trust. Learn more
Transaction
Acknowledgment
https://example.com
Account Address
NULSd6HgTwme2Q...
|
Method Name |
Transaction Fee Calculating... |
Only allow sites you trust. Learn more
Transaction
Successful
Open Transaction Status
in Nulscan.io


|
|
| ~KeyValuePairs () |
| | Destructor.
|
| |
| const char * | getNextProperty () |
| | Get the name of the next property. 更多...
|
| |
|
KeyValuePairs * | getNextNamespace () |
| | Get the next namespace.
|
| |
|
void | rewind () |
| | Rewind the getNextProperty() and getNextNamespace() iterators to the beginning of the file.
|
| |
| KeyValuePairs * | getNamespace (const char *id, bool searchNames=false, bool recurse=true) const |
| | Get a specific namespace by ID or name. 更多...
|
| |
| const char * | getNamespace () const |
| | Get the name of this Property's namespace. 更多...
|
| |
| const char * | getId () const |
| | Get the ID of this Property's namespace. 更多...
|
| |
| bool | exists (const char *name) const |
| | Check if a property with the given name is specified in this KeyValuePairs object. 更多...
|
| |
| Type | getType (const char *name=NULL) const |
| | Returns the type of a property. 更多...
|
| |
| const char * | getString (const char *name=NULL, const char *defaultValue=NULL) const |
| | Get the value of the given property as a string. 更多...
|
| |
| bool | setString (const char *name, const char *value) |
| | Sets the value of the property with the specified name. 更多...
|
| |
| bool | getBool (const char *name=NULL, bool defaultValue=false) const |
| | Interpret the value of the given property as a boolean. 更多...
|
| |
| int | getInt (const char *name=NULL) const |
| | Interpret the value of the given property as an integer. 更多...
|
| |
| float | getFloat (const char *name=NULL) const |
| | Interpret the value of the given property as a floating-point number. 更多...
|
| |
| long | getLong (const char *name=NULL) const |
| | Interpret the value of the given property as a long integer. 更多...
|
| |
| bool | getMatrix3 (const char *name, Matrix3 *out) const |
| | Interpret the value of the given property as a Matrix. 更多...
|
| |
| bool | getMatrix4 (const char *name, Matrix4 *out) const |
| | Interpret the value of the given property as a Matrix. 更多...
|
| |
| bool | getVector2 (const char *name, Vector2 *out) const |
| | Interpret the value of the given property as a Vector2. 更多...
|
| |
| bool | getVector3 (const char *name, Vector3 *out) const |
| | Interpret the value of the given property as a Vector3. 更多...
|
| |
| bool | getVector4 (const char *name, Vector4 *out) const |
| | Interpret the value of the given property as a Vector4. 更多...
|
| |
| bool | getQuaternionFromAxisAngle (const char *name, Quaternion *out) const |
| | Interpret the value of the given property as a Quaternion specified as an axis angle. 更多...
|
| |
| bool | getColor (const char *name, Vector3 *out) const |
| | Interpret the value of the given property as an RGB color in hex and write this color to a Vector3. 更多...
|
| |
| bool | getColor (const char *name, Vector4 *out) const |
| | Interpret the value of the given property as an RGBA color in hex and write this color to a Vector4. 更多...
|
| |
| bool | getPath (const char *name, std::string *path) const |
| | Gets the file path for the given property if the file exists. 更多...
|
| |
| const char * | getVariable (const char *name, const char *defaultValue=NULL) const |
| | Returns the value of a variable that is set in this KeyValuePairs object. 更多...
|
| |
| void | setVariable (const char *name, const char *value) |
| | Sets the value of the specified variable. 更多...
|
| |
|
| static KeyValuePairs * | create (const std::string &url) |
| | Creates a KeyValuePairs runtime settings from the specified URL, where the URL is of the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>" (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional). 更多...
|
| |
| static bool | parseVector2 (const char *str, Vector2 *out) |
| | Attempts to parse the specified string as a Vector2 value. 更多...
|
| |
| static bool | parseVector3 (const char *str, Vector3 *out) |
| | Attempts to parse the specified string as a Vector3 value. 更多...
|
| |
| static bool | parseVector4 (const char *str, Vector4 *out) |
| | Attempts to parse the specified string as a Vector4 value. 更多...
|
| |
| static bool | parseAxisAngle (const char *str, Quaternion *out) |
| | Attempts to parse the specified string as an axis-angle value. 更多...
|
| |
| static bool | parseColor (const char *str, Vector3 *out) |
| | Attempts to parse the specified string as an RGB color value. 更多...
|
| |
| static bool | parseColor (const char *str, Vector4 *out) |
| | Attempts to parse the specified string as an RGBA color value. 更多...
|
| |
| bool IDreamSky::KeyValuePairs::getColor |
( |
const char * |
name, |
|
|
Vector3 * |
out |
|
) |
| const |
Interpret the value of the given property as an RGB color in hex and write this color to a Vector3.
E.g. 0xff0000 represents red and sets the vector to (1, 0, 0). If the property does not exist, out will be set to Vector3(0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vector3(0.0f, 0.0f, 0.0f).
- 參數
-
| name | The name of the property to interpret, or NULL to return the current property's value. |
| out | The vector to set to this property's interpreted value. |
- 傳回值
- True on success, false if the property does not exist or could not be scanned.
| bool IDreamSky::KeyValuePairs::getColor |
( |
const char * |
name, |
|
|
Vector4 * |
out |
|
) |
| const |
Interpret the value of the given property as an RGBA color in hex and write this color to a Vector4.
E.g. 0xff0000ff represents opaque red and sets the vector to (1, 0, 0, 1). If the property does not exist, out will be set to Vector4(0.0f, 0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vector4(0.0f, 0.0f, 0.0f, 0.0f).
- 參數
-
| name | The name of the property to interpret, or NULL to return the current property's value. |
| out | The vector to set to this property's interpreted value. |
- 傳回值
- True on success, false if the property does not exist or could not be scanned.
| const char * IDreamSky::KeyValuePairs::getNextProperty |
( |
| ) |
|
Get the name of the next property.
If a valid next property is returned, the value of the property can be retrieved using any of the get methods in this class, passing NULL for the property name.
@return The name of the next property, or NULL if there are no properties remaining.
| bool IDreamSky::KeyValuePairs::getVector3 |
( |
const char * |
name, |
|
|
Vector3 * |
out |
|
) |
| const |
Interpret the value of the given property as a Vector3.
If the property does not exist, out will be set to Vector3(0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vector3(0.0f, 0.0f, 0.0f).
- 參數
-
| name | The name of the property to interpret, or NULL to return the current property's value. |
| out | The vector to set to this property's interpreted value. |
- 傳回值
- True on success, false if the property does not exist or could not be scanned.
| bool IDreamSky::KeyValuePairs::getVector4 |
( |
const char * |
name, |
|
|
Vector4 * |
out |
|
) |
| const |
Interpret the value of the given property as a Vector4.
If the property does not exist, out will be set to Vector4(0.0f, 0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vector4(0.0f, 0.0f, 0.0f, 0.0f).
- 參數
-
| name | The name of the property to interpret, or NULL to return the current property's value. |
| out | The vector to set to this property's interpreted value. |
- 傳回值
- True on success, false if the property does not exist or could not be scanned.
| bool IDreamSky::KeyValuePairs::parseAxisAngle |
( |
const char * |
str, |
|
|
Quaternion * |
out |
|
) |
| |
|
static |
Attempts to parse the specified string as an axis-angle value.
The specified string is expected to contain four comma-separated values, where the first three values represents the axis and the fourth value represents the angle, in degrees.
On error, false is returned and the output is set to all zero values.
- 參數
-
| str | The string to parse. |
| out | A Quaternion populated with the orientation of the axis-angle, if successful. |
- 傳回值
- True if a valid axis-angle was parsed, false otherwise.
| bool IDreamSky::KeyValuePairs::setString |
( |
const char * |
name, |
|
|
const char * |
value |
|
) |
| |
Sets the value of the property with the specified name.
If there is no property in this namespace with the current name, one is added. Otherwise, the value of the first property with the specified name is updated.
If name is NULL, the value current property (see getNextProperty) is set, unless there is no current property, in which case false is returned.
- 參數
-
| name | The name of the property to set. |
| value | The property value. |
- 傳回值
- True if the property was set, false otherwise.


Partisanship at assembly elections will bring ‘Boko Haram’ to Ghana – Former NALAG President
Openly making elections of Assembly members partisanship is a recipe of disaster, according to a former president of National Association of Local Authorities of Ghana (NALAG), Mr Ebenezer Akuoku-Frimpong.
“It will bring violence, confusion and chaos as being done by Boko Haram in Nigeria”, he observed when spoke on Kumasi FM’s morning show hosted by Nana Yaw Mensah Joel and monitored by MyNewsGh.com.
According to the former District Chief Executive (DCE) for Sekyere Central in the Ashanti Region, making local; Assembly elections partisanship will stall development in the communities contrary to the view held by others.
“I have been a DCE for thirteen years and where there is politics, there is no development so I don’t know what people are looking for”, Mr. Emmanuel Akuako-Frimpong stated urging Ghanaians to vote ‘NO’ in the December 17 referendum which sought to make elections of Metropolitan, Municipal District, and well as Assembly members and Unit Committee elections partisan.
The election of MMDCEs
Parliament is currently in the process of amending Article 243/1 of the Constitution to make the position of Metropolitan, Municipal and District Chief Executives (MMDCEs) elected, taking away the appointing power of the President.
The government is fiercely campaigning for Article 55/3 of the Constitution to be amended to allow political parties to participate in local assembly elections.
When that happens, political parties can field candidates for the MMDCE elections, a system the ‘YES’ campaigners say would give the smaller parties — who are almost extinct at the national level — some control.


Loading documentation viewer
function tl(strings: TemplateStringsArray, ...values: any[]): TextLabelFactory;
function tl(text: string | Async.ObservableValue<string>, baseClass?: typeof Label): TextLabelFactory;
function tl(getter: () => (string | Async.ObservableValue<string>), baseClass?: typeof Label): TextLabelFactory;
function tl(getter: Binding<string>, baseClass?: typeof Label): TextLabelFactory;
[1]. Tagged template string function that returns a text label factory instance to be used with component factory content lists; functions in the expanded values (i.e. result of ${...}
), and bindings (instanceof Binding), are used as getters for nested observable string values (e.g. ${() => ...}
is observed and converted to a string); pluralization forms can be substituted based on existing arguments by number (base 1) using e.g. %{1|is|are}
; prefixes can be used to change the type of component factory created and its styles and properties:
{p}
for Paragraph,{h1-6}
for Heading,{w}
for WideLabel,{b|i|u}
for text styles,{left|center|right}
for alignment,{#...}
for text colors,{nnn}
for font weights,{icon:...}
for icons,{icon:... property-name=...}
for icon style properties,{property-name=...}
or {propertyName=...}
for individual style properties,{.classname}
and {.class1.class2}
for class name(s),{...%|...em|...rem| etc.}
for font sizes, and{l:...%|...rem| etc.}
for Label with given width;Prefixes can be combined using the pipe | symbol and may also be the result of an expanded value (i.e. first ${…} part).
[2]. Simplified version of tagged template helper .tl`…` with a single piece of text, possibly with a base Label class that is used if given string does not override the class using e.g. {p}
or {h1}
.
[3]. Simplified version of tagged template helper .tl`…` observing a single piece of text, possibly with a base Label class that is used if given string does not override the class using e.g. {p}
or {h1}
.
[4]. Simplified version of tagged template helper .tl`…` observing a single binding, possibly with a base Label class that is used if given string does not override the class using e.g. {p}
or {h1}
.
This is the documentation page for “tl (UI.tl)”, part of the Typescene toolkit.


[§8-22] Kalo Appreciation Month. The month of October shall be known and designated as "Kalo Appreciation Month" to celebrate the strong kalo tradition in Hawaii and the cultural connection of native Hawaiians to kalo, the Hawaiian word for taro. This month is not and shall not be construed as a state holiday. [L 2013, c 7, §2]


Calculation of fluid properties for Tetrafluoroethane (R134a) in the fluid region of 0.0039 bar (Triple pressure) to 700 bar and 169.85 Kelvin (Triple temperature) to 455 Kelvin.
The functions provided by this package shall be used inside of the restricted limits according to the referenced literature.
References
The verification report for the development of this library is provided here.
This library was developed by XRG Simulation GmbH as part of the Clean Sky JTI project (Project title: MoMoLib-Modelica Model Library Development for Media, Magnetic Systems and Wavelets; Project number: 296369; Theme: JTI-CS-2011-1-SGO-02-026: Modelica Model Library Development Part I). The partial financial support for the development of this library by the European Union is highly appreciated.
Some parts of this library refer to the ThermoFluid library developed at Lund University (http://thermofluid.sourceforge.net).
Copyright © 2013-2019, Modelica Association and contributors
| Name | Description |
|---|---|
| Common | |
| R134a_ph | Medium model for R134a and p,h as states |
| R134aData | R134a data required by package R134a_ph |


A Few of My Favorite Things
Information Organizational Structures and Leslie Knope
April 2nd, 2015
Ruby has two important organizational structures: arrays and hashes. They are both actually just fancy lists.
Home is Where the Positioning Is
Fixed, Relative, and Absolute Positioning in CSS
March 29, 2015
Every element of an HTML document has a home.
Vulnerability and Hedgehogs
My feelings on the culture of Dev Bootcamp
March 24, 2015
Growing up, my sister and I had a pet hedgehog named Piglet.
Fears, Tears, and the Eldritch World of the Command Line
Dev Bootcamp, week 1
March 23, 2015
So Dev Bootcamp is requiring me and my fellow boots to write blog posts about our learning experience.


Embedded Jetty Sample Home Page
Hello world
Boostrap.css served as static content
The "hello world" webservice WSDL
The url of the images/stylesheets are embedded as a resource handler on the wicket servlet.


This database contains the attendance record of Council and committee open meetings since the sixth term.
For more details of the database, see https://www.legco.gov.hk/odata/english/attendance-db.html.
Here are the key identifies that is useful for locating the necessary data from the Attendance Database:
CommitteeID
is the numerical ID of a LegCo
committee. It is same as the one in the Meeting Schedule
Database.
MeetID
is the numerical ID of a Council or committee
meeting. It is same as the one in the Meeting Schedule
Database.
MemberID
is the numerical ID of a LegCo member. It
is same as the one in the Meeting Schedule Database. Note that it is a
separate identifier from the SpeakerID
of the Hansard
Database.
The function in this database has an option to return only the total
count of the records matching the specified parameters instead of
returning the data frame containing the result. To activate this option,
specify count = TRUE
:
# Fetch the total number of members absent from the Council meeting on May 22, 2019
attendance(meet_id = 136897, from = "2019-05-22", to = "2019-05-22", attn = "a", count = TRUE)
## [1] "2"
This database is accessible with the following function:
attendance()
fetches the attendance record of one or
more LegCo meeting(s), or the attendance record of one of more LegCo
member(s), or both.
# Fetch members who were absent from the Subcommittee on Issues Relating to Bazaars meetings on October 13, 2017
attendance(committee_id = 2704, from = "2017-10-13", to = "2017-10-13", attn = "a")
## CommitteeID MeetID MeetingNameEnglish
## 1 2704 127931 Meeting of Subcommittee on Issues Relating to Bazaars
## 2 2704 127931 Meeting of Subcommittee on Issues Relating to Bazaars
## 3 2704 127931 Meeting of Subcommittee on Issues Relating to Bazaars
## 4 2704 127931 Meeting of Subcommittee on Issues Relating to Bazaars
## 5 2704 127931 Meeting of Subcommittee on Issues Relating to Bazaars
## MeetingNameChinese MeetingStartDateTime MemberID MemberNameEnglish
## 1 墟市事宜小組委員會會議 2017-10-13 08:30:00 750 Hon Steven HO Chun-yin
## 2 墟市事宜小組委員會會議 2017-10-13 08:30:00 759 Hon Kenneth LEUNG
## 3 墟市事宜小組委員會會議 2017-10-13 08:30:00 776 Hon CHU Hoi-dick
## 4 墟市事宜小組委員會會議 2017-10-13 08:30:00 779 Hon HO Kai-ming
## 5 墟市事宜小組委員會會議 2017-10-13 08:30:00 791 Hon LUK Chung-hung
## MemberNameChinese PresentAbsent
## 1 何俊賢議員 Absent
## 2 梁繼昌議員 Absent
## 3 朱凱廸議員 Absent
## 4 何啟明議員 Absent
## 5 陸頌雄議員 Absent
# Fetch the meetings that Hon Chu Hoi-dick was absent from
v <- attendance(member_id = 776, attn = "a")
head(v)
## CommitteeID MeetID MeetingNameEnglish MeetingNameChinese
## 1 2548 120628 Regular House Committee Meeting 內務委員會例會
## 2 2548 120629 Meeting of House Committee 內務委員會會議
## 3 2548 120630 Meeting of House Committee 內務委員會會議
## 4 2548 120631 Meeting of House Committee 內務委員會會議
## 5 2548 120632 Meeting of House Committee 內務委員會會議
## 6 2548 120639 Meeting of House Committee 內務委員會會議
## MeetingStartDateTime MemberID MemberNameEnglish MemberNameChinese
## 1 2017-01-06 14:30:00 776 Hon CHU Hoi-dick 朱凱廸議員
## 2 2017-01-13 14:30:00 776 Hon CHU Hoi-dick 朱凱廸議員
## 3 2017-01-20 14:30:00 776 Hon CHU Hoi-dick 朱凱廸議員
## 4 2017-02-03 14:30:00 776 Hon CHU Hoi-dick 朱凱廸議員
## 5 2017-02-10 14:30:00 776 Hon CHU Hoi-dick 朱凱廸議員
## 6 2017-05-12 14:30:00 776 Hon CHU Hoi-dick 朱凱廸議員
## PresentAbsent
## 1 Absent
## 2 Absent
## 3 Absent
## 4 Absent
## 5 Absent
## 6 Absent