Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are the limits for Qt types?

Regularly, I could reference limits.h to see what the max is for a certain type, like an int or long.

In Qt, there are types like qlonglong. Is there a header file and/or documentation that can be used in a similar way to manually or programmatically reference the limits of these types?

like image 502
Cory Klein Avatar asked Jan 25 '11 00:01

Cory Klein


2 Answers

There's a high likelihood the Qt types distill down to one of the basic types for which numeric_limits are defined. Have you tried calling e.g., std::numeric_limits<qlonglong>::max()?

As MSalters points out, too, if the types are not builtin numeric_limits can still be specialized for them. If that were the case one would hope Qt would include them.

like image 198
fbrereto Avatar answered Oct 02 '22 05:10

fbrereto


Take a look at the QtGlobal documentation.

For some of the non-obvious ones:
qlonglong - 64-bit
qptrdiff - 32-bit or 64-bit depending on platform
qreal - double (float on ARM architectures)
quintptr - unsigned 32-bit or 64-bit depending on platform
qulonglong - unsigned 64-bit
uchar, uint, ulong, ushort - convenience shorthand for unsigned types

like image 38
richardwb Avatar answered Oct 02 '22 05:10

richardwb