全局变量定义
为了确保在各个平台上各数据类型都有统一确定的长度,Qt 为各种常见数据类型定义了类型符号,如 qint8 就是 signed char 的类型定义,即:
typedef signed char qint8;
<QtGlobal>中定义的数据类型见表 1。
Qt 数据类型 | 等效定义 | 字节数 |
---|---|---|
qint8 | signed char | 1 |
qint16 | signed short | 2 |
qint32 | signed int | 4 |
qint64 | long long int | 8 |
qlonglong | long long int | 8 |
quint8 | unsigned char | 1 |
quint16 | unsigned short | 2 |
quint32 | unsigned int | 4 |
quint64 | unsigned long long int | 8 |
qulonglong | unsigned long long int | 8 |
uchar | unsigned char | 1 |
ushort | unsigned short | 2< |