GridView控件:LEFTMARGIN和rightMargin属性没有按不行
问题描述:
它工作好为Flickable
(即Flickable
与Grid
和同Rectangle
S(见它下面的代码))。GridView控件:LEFTMARGIN和rightMargin属性没有按不行
下面是GridView的一个例子:
import QtQuick 2.7
import QtQuick.Controls 1.4
ApplicationWindow {
id: rootWindow
visible: true
width: 300
height: 300
Rectangle {
anchors.fill: parent
color: "yellow"
GridView {
id: gridView
anchors.fill: parent
cellWidth: 50
cellHeight: 50
model: 54
bottomMargin: 10
topMargin: 10
leftMargin: 10 // this doesn't work
rightMargin: 10 // this doesn't work
delegate: Rectangle {
width: gridView.cellWidth - 1
height: gridView.cellHeight - 1
color: "green"
}
}
}
}
我缺少的东西或者是它只是一个错误?
答
也许这是你在找什么:
...
GridView {
id: gridView
anchors {
fill: parent
margins: 10
}
clip: true
cellWidth: 50
cellHeight: 50
model: 54
delegate: Rectangle {
width: gridView.cellWidth - 1
height: gridView.cellHeight - 1
color: "green"
}
}
...
看起来像水木清华奇怪是怎么回事,真的 - 我想在https://bugreports.qt.io这个文件,看看他们在说什么。我认为GridXXX的东西有很多问题,所以不要浪费。 – mlvljr