QMLProfiler 中的 QML Listview 报告两次委托创建
QML Listview in QMLProfiler reporting twice delegate creation
这是一个只有 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
}
}
}
}
答案可以从 Qt 错误报告中找到 QML Profiler 显示双倍数量的 Repeater delegate Create 调用
告诉以下内容:
Object creation typically happens in two stages, which are counted
separately in the profiler.
Each object creation involves one creation phase and one callback to
componentComplete(). Those are tracked separately.
这是一个只有 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
}
}
}
}
答案可以从 Qt 错误报告中找到 QML Profiler 显示双倍数量的 Repeater delegate Create 调用 告诉以下内容:
Object creation typically happens in two stages, which are counted separately in the profiler.
Each object creation involves one creation phase and one callback to componentComplete(). Those are tracked separately.