What is the meaning of colon (:) operator in "uint isWidget : 1;" in Qt? Is "uint isWidget : 1;" equivalent to "uint isWidget(1)"?
The code in Qt is
QObjectData
{
public:
virtual ~QObjectData() = 0;
QObject *q_ptr;
QObject *parent;
QObjectList children;
uint isWidget : 1;
uint pendTimer : 1;
uint blockSig : 1;
uint wasDeleted : 1;
uint ownObjectName : 1;
uint sendChildEvents : 1;
uint receiveChildEvents : 1;
uint inEventHandler : 1;
uint inThreadChangeEvent : 1;
uint hasGuards : 1; //true iff there is one or more QPointer attached to this object
uint unused : 22;
int postedEvents;
QMetaObject *metaObject; // assert dynamic
};
This is part of C struct
notation - you can specify the size of an integer field in bits by using a : numBits
after the property name.
I must assume that the same syntax can be used in a C++ class (i'm a C guy, but i'm sure that this is doing the same thing in C++)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With