qml虽然是js关联Qt,但是他并没有把QWidget关联在一起,qml的绘制是使用类似directshow的一种绘制方式就是全局都是一些item,并不是使用窗口;
很多时候我们要需要布局一些类似的东西,用Row, Column, Grid布局,这时候就要善用Repeater, Repeater给这些布局使用, 用起来效果很好比如我要绘制一个列表并且可以滚动
Flickable {
signal detailRout(var rt)
id: routeCol
clip: true
anchors {top: btnCreate.bottom; topMargin: 2; left: parent.left; right: parent.right; bottom: parent.bottom}
contentHeight: colBoundary.height
contentWidth: width
flickableDirection: Flickable.VerticalFlick
Column{
id: colBoundary
visible: true
spacing: 4
Rectangle{
color: "transparent"
width: routeCol.width
height: 1
}
Repeater{
model: mapManager.getSpecItems(MapAbstractItem.Type_FlyRoute)
delegate: Rectangle{
width: routeCol.width
height: itemLand1.height+10
color: object.itemColor
visible: object.visible
border {width: 1; color: object.selected ? "#b7C2FF":"transparent"}
MouseArea{
anchors.fill: parent
onClicked: {emit:selectRoute(object)}
}
Column{
id: