【发布时间】:2020-06-18 13:32:14
【问题描述】:
这是一个只有 10 个项目的简单 ListView。当我为此应用程序运行 QMLProfiler 时,统计数据显示创建委托的调用次数是两倍。有人可以解释一下这种行为吗?
import QtQuick 2.12
import QtQuick.Window 2.12
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
ListView{
anchors.fill: parent
model: 10
delegate: Rectangle{
width: parent.width
height: 60
Text {
id: name
text: qsTr("Item is ") + index
}
}
}
}
【问题讨论】: