The <QtTypes> header file includes Qt fundamental type declarations. 更多...
| 頭: |
#include <QtTypes>
|
| qint8 | |
| qint16 | |
| qint32 | |
| qint64 | |
(從 6.6 起)
|
qint128 |
| qintptr | |
| qlonglong | |
| qptrdiff | |
| qreal | |
| qsizetype | |
| quint8 | |
| quint16 | |
| quint32 | |
| quint64 | |
(從 6.6 起)
|
quint128 |
| quintptr | |
| qulonglong | |
| uchar | |
| uint | |
| ulong | |
| ushort |
(從 6.2 起)
|
|
(從 6.2 起)
|
|
(從 6.2 起)
|
|
(從 6.2 起)
|
|
(從 6.2 起)
|
PRIXQUINTPTR |
(從 6.2 起)
|
PRIdQINTPTR |
(從 6.2 起)
|
PRIdQPTRDIFF |
(從 6.2 起)
|
PRIdQSIZETYPE |
(從 6.2 起)
|
PRIiQINTPTR |
(從 6.2 起)
|
PRIiQPTRDIFF |
(從 6.2 起)
|
PRIiQSIZETYPE |
(從 6.2 起)
|
PRIoQUINTPTR |
(從 6.2 起)
|
PRIuQUINTPTR |
(從 6.2 起)
|
PRIxQUINTPTR |
(從 6.6 起)
|
QT_SUPPORTS_INT128 |
(從 6.6 起)
qint128
|
Q_INT128_C ( literal ) |
(從 6.6 起)
|
Q_INT128_MAX |
(從 6.6 起)
|
Q_INT128_MIN |
| qint64 | Q_INT64_C ( literal ) |
(從 6.6 起)
quint128
|
Q_UINT128_C ( literal ) |
(從 6.6 起)
|
Q_UINT128_MAX |
| 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
unsigned 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
。 此類型保證在由 Qt 支持的所有平颱都為 64 位。
可以創建此類型的文字使用 Q_INT64_C () 宏:
qint64 value = Q_INT64_C(932838457459459);
另請參閱 Q_INT64_C (), quint64 ,和 qlonglong .
[since 6.6]
qint128
typedef 對於
__int128
在支持它的平颱 (Qt 定義宏
QT_SUPPORTS_INT128
若是這種情況)。
可以創建此類型的文字使用 Q_INT128_C () 宏。
該 typedef 在 Qt 6.6 引入。
另請參閱 Q_INT128_C (), Q_INT128_MIN , Q_INT128_MAX , quint128 ,和 QT_SUPPORTS_INT128 .
用於以有符號整數錶示指針的整型 (對哈希等有用)。
typedef 為 qint32 或 qint64。此類型保證在 Qt 支持的所有平颱,指針的大小相同。在采用 32 位指針的係統中,qintptr typedef 為 qint32;在采用 64 位指針的係統中,qintptr typedef 為 qint64。
注意,qintptr 有符號。使用 quintptr 對於無符號值。
為通過使用格式化輸齣設施打印這種類型的值,譬如
printf()
,
qDebug
(),
QString::asprintf
() 等,可以使用
PRIdQINTPTR
and
PRIiQINTPTR
宏作為格式說明符。它們兩者將打印以 10 為基數的值。
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 為無符號值。
為通過使用格式化輸齣設施打印這種類型的值,譬如
printf()
,
qDebug
(),
QString::asprintf
() 等,可以使用
PRIdQPTRDIFF
and
PRIiQPTRDIFF
宏作為格式說明符。它們兩者將打印以 10 為基數的值。
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
對於無符號值。
為通過使用格式化輸齣設施打印這種類型的值,譬如
printf()
,
qDebug
(),
QString::asprintf
() 等,可以使用
PRIdQSIZETYPE
and
PRIiQSIZETYPE
宏作為格式說明符。它們兩者將打印以 10 為基數的值。
qsizetype s = 123; printf("The size is %" PRIdQSIZETYPE "\n", s);
另請參閱 qptrdiff .
typedef 對於
unsigned char
。此類型保證在 Qt 支持的所有平颱為 8 位。
typedef 對於
unsigned short
。此類型保證在 Qt 支持的所有平颱為 16 位。
typedef 對於
unsigned int
。此類型保證在 Qt 支持的所有平颱為 32 位。
typedef 對於
unsigned long long int
。 此類型保證在由 Qt 支持的所有平颱都為 64 位。
可以創建此類型的文字使用 Q_UINT64_C () 宏:
quint64 value = Q_UINT64_C(932838457459459);
另請參閱 Q_UINT64_C (), qint64 ,和 qulonglong .
[since 6.6]
quint128
typedef 對於
unsigned __int128
在支持它的平颱 (Qt 定義宏
QT_SUPPORTS_INT128
若是這種情況)。
可以創建此類型的文字使用 Q_UINT128_C () 宏。
該 typedef 在 Qt 6.6 引入。
另請參閱 Q_UINT128_C (), Q_UINT128_MAX , qint128 ,和 QT_SUPPORTS_INT128 .
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.
為通過使用格式化輸齣設施打印這種類型的值,譬如
printf()
,
qDebug
(),
QString::asprintf
() and so on, you can use the following macros as format specifiers:
PRIuQUINTPTR
:以 10 為基數打印值。
PRIoQUINTPTR
:以 8 為基數打印值。
PRIxQUINTPTR
:以 16 為基數打印值,使用小寫
a-f
字母。
PRIXQUINTPTR
:以 16 為基數打印值,使用大寫
A-F
字母。
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 對於
unsigned int
.
方便 typedef 對於
unsigned long
.
方便 typedef 對於
unsigned short
.
[since 6.2]
PRIdQINTPTR
[since 6.2]
PRIiQINTPTR
見 qintptr .
該函數在 Qt 6.2 引入。
[since 6.2]
PRIXQUINTPTR
[since 6.2]
PRIoQUINTPTR
[since 6.2]
PRIuQUINTPTR
[since 6.2]
PRIxQUINTPTR
見 quintptr。
該函數在 Qt 6.2 引入。
[since 6.2]
PRIdQPTRDIFF
[since 6.2]
PRIiQPTRDIFF
見 qptrdiff。
該函數在 Qt 6.2 引入。
[since 6.2]
PRIdQSIZETYPE
[since 6.2]
PRIiQSIZETYPE
見 qsizetype。
該函數在 Qt 6.2 引入。
[since 6.6]
QT_SUPPORTS_INT128
Qt 定義此宏及 qint128 and quint128 類型若平颱支持 128 位整數類型。
該宏在 Qt 6.6 引入。
另請參閱 qint128 , quint128 , Q_INT128_C (), Q_UINT128_C (), Q_INT128_MIN , Q_INT128_MAX ,和 Q_UINT128_MAX .
[since 6.6]
qint128
Q_INT128_C
(
literal
)
包裹有符號 128 位整數 literal 以獨立於平颱的方式。
注意: 不像 Q_INT64_C (), this macro is only available in C++, not in C. This is because compilers do not provide these literals as built-ins and C does not have support for user-defined literals.
該宏在 Qt 6.6 引入。
另請參閱 qint128 , Q_UINT128_C (), Q_INT128_MIN , Q_INT128_MAX , Q_INT64_C (),和 QT_SUPPORTS_INT128 .
[since 6.6]
Q_INT128_MAX
This macro expands to a compile-time constant representing the maximum value representable in a qint128 .
此宏可用於 C++ 和 C 模式兩者。
該宏在 Qt 6.6 引入。
另請參閱 Q_INT128_MIN , Q_UINT128_MAX , qint128 , Q_INT128_C ,和 QT_SUPPORTS_INT128 .
[since 6.6]
Q_INT128_MIN
This macro expands to a compile-time constant representing the minimum value representable in a qint128 .
此宏可用於 C++ 和 C 模式兩者。
該宏在 Qt 6.6 引入。
另請參閱 Q_INT128_MAX , qint128 , Q_INT128_C ,和 QT_SUPPORTS_INT128 .
包裹有符號 64 位整數 literal 以獨立於平颱的方式。
範例:
qint64 value = Q_INT64_C(932838457459459);
另請參閱 qint64 , Q_UINT64_C (),和 Q_INT128_C ().
[since 6.6]
quint128
Q_UINT128_C
(
literal
)
包裹無符號 128 位整數 literal 以獨立於平颱的方式。
注意: 不像 Q_UINT64_C (), this macro is only available in C++, not in C. This is because compilers do not provide these literals as built-ins and C does not have support for user-defined literals.
該宏在 Qt 6.6 引入。
另請參閱 quint128 , Q_INT128_C (), Q_UINT128_MAX , Q_UINT64_C (),和 QT_SUPPORTS_INT128 .
[since 6.6]
Q_UINT128_MAX
This macro expands to a compile-time constant representing the maximum value representable in a quint128 .
此宏可用於 C++ 和 C 模式兩者。
最小化的
quint128
為 0 (零),因此
Q_UINT128_MIN
既不需要也不提供。
該宏在 Qt 6.6 引入。
另請參閱 Q_INT128_MAX , quint128 , Q_UINT128_C ,和 QT_SUPPORTS_INT128 .
包裹無符號 64 位整數 literal 以獨立於平颱的方式。
範例:
quint64 value = Q_UINT64_C(932838457459459);
另請參閱 quint64 , Q_INT64_C (),和 Q_UINT128_C ().