This question already has answers here:
What does a colon in a struct declaration mean, such as :1, :7, :16, or :32?
(3个答案)
5年前关闭。
“uint isWidget:1;”中的冒号(:)运算符是什么意思?在Qt中?是“uint isWidget:1;”相当于“uint isWidget(1)”?
Qt中的代码是
(3个答案)
5年前关闭。
“uint isWidget:1;”中的冒号(:)运算符是什么意思?在Qt中?是“uint isWidget:1;”相当于“uint isWidget(1)”?
Qt中的代码是
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
};
最佳答案
这是C struct
表示法的一部分-您可以通过在属性名称后使用: numBits
来指定整数字段的大小(以位为单位)。
我必须假定可以在C++类中使用相同的语法(我是C家伙,但是我敢肯定,这在C++中也做同样的事情)
关于c++ - 冒号(:) operator in "uint isWidget : 1;" in Qt?是什么意思,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4825868/
10-13 07:37