http://doc.qt.io/archives/qt-4.7/anchor-layout.html 告诉父级的anchors.right
是"一条不可见的锚线",并指向Item
的属性anchors.right : AnchorLine
但是parent.right
和parent.anchors.right
似乎是不同的东西(你通常不能锚定到后者,而像预期的那样锚定前者)。
有人向文档提示我吗?
我没有找到任何文档,但查看来源表明parent.right
是一个常量,parent.anchors.right
是一个可以设置关联的地方。
所以它们不应该是一样的。你可以把parent.right
想象成const int RIGHT=1;
,把parent.anchors.right
想象成int rightAnchor;
是锚线(QDeclarativeAnchorLine
),如果设置了锚点,甚至可以锚定到parent.anchors.right
(或任何其他项目的anchors.right
)。