比如:Column {
id: layout
anchors {
left: parent.left
top: parent.top
}
}
就是类似这样的设置老是报下面相关的错误信息,但是位置设置确实起了作用,想知道为什么会这样,求高人指点,谢谢。
QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column
QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row
coloum里面不要用anchor,因为column已经在帮你管理item的位置了。你设置了anchor如果和column冲突,是无效的。
不是说coloum不能用,是说coloum里面的item不要用,因为coloum和row本身就是布局元素,它会自动调整内部的元素位置,再用anchor可能冲突不起作用。比如coloum{ Rectangle { anchor....},Rectangle { anchor....} }