在qml中设置网格的ChildrenRect宽度?

Aja*_*jay 2 qml

我需要知道如何为网格元素设置ChildrenRect的高度和宽度?

 Grid {
             id: grid1
             anchors.fill: parent
             rows: 10
             columns: 10


             childrenRect.height: background.height/10
             childrenRect.width: background.width/10

         }
Run Code Online (Sandbox Code Playgroud)

它说它是一个只读元素,当我尝试这样做时无法改变.

sep*_*p2k 5

你不能设置它们.该childrenRect属性是从项目的儿童计算.影响它们的唯一方法是设置孩子的尺寸.没有办法自己设置它们.