Kak*_*adu 5 performance models qml
我已经创建了这个 QML 窗口,但是当我用鼠标抓住它的边框并调整它的大小时,窗口的内容重新绘制非常缓慢。你可以克隆我的repo并自己测试。任何想法如何提高性能?
import QtQuick 2.0
Rectangle {
id: root
width: 600
height: 600
color: "lightgrey"
ListView {
model: mainModel
spacing: 5
width: parent.width
orientation: ListView.Horizontal
delegate: Rectangle {
//width: parent.desiredWidth / mainModel.dataLen()//+ " " + model.sort
width: root.width / mainModel.dataLen() - 10
//width: 200
ListView {
id: lv1
ScrollBar {
flickable: lv1
vertical: true
hideScrollBarsWhenStopped: false
scrollbarWidth: 5
}
model: homm
spacing: 5
width: parent.width
height: 150
orientation: ListView.Vertical
delegate:
Rectangle {
radius: 5
anchors.rightMargin: 5
anchors.leftMargin: 5
width: lv1.width
height: 20
color: "black"
Text { text: model.name
anchors.fill: parent
color: "white"
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
在这个 QML 中,我有 listView 的 listView,它可视化了 ListModels 的 ListModel。homm是主模型的属性名称。内部模型的元素有一个名为 的属性name。您可以在此处和此处浏览这些类的代码。
| 归档时间: |
|
| 查看次数: |
1217 次 |
| 最近记录: |