【问题标题】:QML Listview in QMLProfiler reporting twice delegate creationQMLProfiler 中的 QML Listview 报告两次委托创建
【发布时间】: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
            }
        }
    }
}

【问题讨论】:

    标签: qt listview qml qt5


    【解决方案1】:

    可以从 Qt 错误报告 QML Profiler shows double amount of Repeater delegate Create calls 中找到答案:

    对象创建通常分两个阶段进行,这两个阶段被计算在内 分别在探查器中。

    每个对象创建都涉及一个创建阶段和一个回调 组件完成()。这些是单独跟踪的。

    【讨论】:

      猜你喜欢
      • 2015-12-03
      • 2017-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多