例如,在QML中究竟什么是parent.right,它与parent.anchors.right有何不同



http://doc.qt.io/archives/qt-4.7/anchor-layout.html 告诉父级的anchors.right是"一条不可见的锚线",并指向Item的属性anchors.right : AnchorLine

但是parent.rightparent.anchors.right似乎是不同的东西(你通常不能锚定到后者,而像预期的那样锚定前者)。

有人向文档提示我吗?

我没有找到任何文档,但查看来源表明parent.right是一个常量,parent.anchors.right是一个可以设置关联的地方。

所以它们不应该是一样的。你可以把parent.right想象成const int RIGHT=1;,把parent.anchors.right想象成int rightAnchor;

两者都

是锚线(QDeclarativeAnchorLine),如果设置了锚点,甚至可以锚定到parent.anchors.right(或任何其他项目的anchors.right)。

最新更新