The <QtTypes> header file includes Qt fundamental type declarations. 更多...
| 頭: | #include <QtTypes> |
| qint8 | |
| qint16 | |
| qint32 | |
| qint64 | |
| qintptr | |
| qlonglong | |
| qptrdiff | |
| qreal | |
| qsizetype | |
| quint8 | |
| quint16 | |
| quint32 | |
| quint64 | |
| quintptr | |
| qulonglong | |
| uchar | |
| uint | |
| ulong | |
| ushort |
| PRIXQUINTPTR | |
| PRIdQINTPTR | |
| PRIdQPTRDIFF | |
| PRIdQSIZETYPE | |
| PRIiQINTPTR | |
| PRIiQPTRDIFF | |
| PRIiQSIZETYPE | |
| PRIoQUINTPTR | |
| PRIuQUINTPTR | |
| PRIxQUINTPTR | |
| qint64 | Q_INT64_C ( literal ) |
| quint64 | Q_UINT64_C ( literal ) |
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
.
Several convenience type definitions are declared:
qreal
for
double
or
float
,
uchar
for
unsigned char
,
uint
for
無符號 int
,
ulong
for
unsigned long
and
ushort
for
unsigned short
.
The header also provides series of macros that make it possible to print some Qt type aliases (qsizetype, qintptr, etc.) via a formatted output facility such as printf() or qDebug () without raising formatting warnings and without the need of a type cast.
typedef 對於
signed char
。此類型保證在 Qt 支持的所有平颱為 8 位。
typedef 對於
signed short
。此類型保證在 Qt 支持的所有平颱為 16 位。
typedef 對於
signed int
。此類型保證在 Qt 支持的所有平颱為 32 位。
typedef 對於
long long int
. This type is guaranteed to be 64-bit on all platforms supported by Qt.
可以創建此類型的文字使用 Q_INT64_C () 宏:
qint64 value = Q_INT64_C(932838457459459);
另請參閱 Q_INT64_C (), quint64 ,和 qlonglong .
用於以有符號整數錶示指針的整型 (對哈希等有用)。
typedef 為 qint32 或 qint64。此類型保證在 Qt 支持的所有平颱,指針的大小相同。在采用 32 位指針的係統中,qintptr typedef 為 qint32;在采用 64 位指針的係統中,qintptr typedef 為 qint64。
注意,qintptr 有符號。使用 quintptr 對於無符號值。
In order to print values of this type by using formatted-output facilities such as
printf()
,
qDebug
(),
QString::asprintf
() and so on, you can use the
PRIdQINTPTR
and
PRIiQINTPTR
macros as format specifiers. They will both print the value as a base 10 number.
qintptr p = 123; printf("The pointer is %" PRIdQINTPTR "\n", p);
另請參閱 qptrdiff , qint32 ,和 qint64 .
typedef 對於
long long int
(
__int64
在 Windows)。這如同
qint64
.
另請參閱 qulonglong and qint64 .
用於錶示指針差異的整型。
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.
注意:qptrdiff 是有符號的。使用 quintptr 為無符號值。
In order to print values of this type by using formatted-output facilities such as
printf()
,
qDebug
(),
QString::asprintf
() and so on, you can use the
PRIdQPTRDIFF
and
PRIiQPTRDIFF
macros as format specifiers. They will both print the value as a base 10 number.
qptrdiff d = 123; printf("The difference is %" PRIdQPTRDIFF "\n", d);
另請參閱 quintptr , qint32 ,和 qint64 .
typedef 對於
double
除非配置 Qt 采用
-qreal float
選項。
[alias]
qsizetype
整型類型提供 POSIX
ssize_t
對於所有平颱。
此類型保證相同大小如
size_t
在 Qt 支持的所有平颱。
注意:qsizetype 無符號。使用
size_t
對於無符號值。
In order to print values of this type by using formatted-output facilities such as
printf()
,
qDebug
(),
QString::asprintf
() and so on, you can use the
PRIdQSIZETYPE
and
PRIiQSIZETYPE
macros as format specifiers. They will both print the value as a base 10 number.
qsizetype s = 123; printf("The size is %" PRIdQSIZETYPE "\n", s);
另請參閱 qptrdiff .
typedef 對於
unsigned char
。此類型保證在 Qt 支持的所有平颱為 8 位。
typedef 對於
unsigned short
。此類型保證在 Qt 支持的所有平颱為 16 位。
typedef 對於
無符號 int
。此類型保證在 Qt 支持的所有平颱為 32 位。
typedef 對於
unsigned long long int
. This type is guaranteed to be 64-bit on all platforms supported by Qt.
可以創建此類型的文字使用 Q_UINT64_C () 宏:
quint64 value = Q_UINT64_C(932838457459459);
另請參閱 Q_UINT64_C (), qint64 ,和 qulonglong .
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.
In order to print values of this type by using formatted-output facilities such as
printf()
,
qDebug
(),
QString::asprintf
() and so on, you can use the following macros as format specifiers:
PRIuQUINTPTR
: prints the value as a base 10 number.
PRIoQUINTPTR
: prints the value as a base 8 number.
PRIxQUINTPTR
: prints the value as a base 16 number, using lowercase
a-f
letters.
PRIXQUINTPTR
: prints the value as a base 16 number, using uppercase
A-F
letters.
quintptr p = 123u; printf("The pointer value is 0x%" PRIXQUINTPTR "\n", p);
另請參閱 qptrdiff , quint32 ,和 quint64 .
typedef 對於
unsigned long long int
(
unsigned __int64
在 Windows)。這如同
quint64
.
方便 typedef 對於
unsigned char
.
方便 typedef 對於
無符號 int
.
方便 typedef 對於
unsigned long
.
方便 typedef 對於
unsigned short
.
[since 6.2]
PRIdQINTPTR
[since 6.2]
PRIiQINTPTR
見 qintptr .
This function was introduced in Qt 6.2.
[since 6.2]
PRIXQUINTPTR
[since 6.2]
PRIoQUINTPTR
[since 6.2]
PRIuQUINTPTR
[since 6.2]
PRIxQUINTPTR
See quintptr.
This function was introduced in Qt 6.2.
[since 6.2]
PRIdQPTRDIFF
[since 6.2]
PRIiQPTRDIFF
See qptrdiff.
This function was introduced in Qt 6.2.
[since 6.2]
PRIdQSIZETYPE
[since 6.2]
PRIiQSIZETYPE
See qsizetype.
This function was introduced in Qt 6.2.
[since 6.2]
PRIXQUINTPTR
This macro was introduced in Qt 6.2.
[since 6.2]
PRIdQINTPTR
This macro was introduced in Qt 6.2.
[since 6.2]
PRIdQPTRDIFF
This macro was introduced in Qt 6.2.
[since 6.2]
PRIdQSIZETYPE
This macro was introduced in Qt 6.2.
[since 6.2]
PRIiQINTPTR
This macro was introduced in Qt 6.2.
[since 6.2]
PRIiQPTRDIFF
This macro was introduced in Qt 6.2.
[since 6.2]
PRIiQSIZETYPE
This macro was introduced in Qt 6.2.
[since 6.2]
PRIoQUINTPTR
This macro was introduced in Qt 6.2.
[since 6.2]
PRIuQUINTPTR
This macro was introduced in Qt 6.2.
[since 6.2]
PRIxQUINTPTR
This macro was introduced in Qt 6.2.
包裹有符號 64 位整數 literal 以獨立於平颱的方式。
範例:
qint64 value = Q_INT64_C(932838457459459);
另請參閱 qint64 and Q_UINT64_C ().
包裹無符號 64 位整數 literal 以獨立於平颱的方式。
範例:
quint64 value = Q_UINT64_C(932838457459459);