当项目完成重绘时,我会收到通知吗?
Can I be notified when a Item has finished repainting?
我正在制作一个项目的快照(通过 ShaderEffectSource
和 live: false
),但有时(200 个案例中有 1 个)我得到一个空白快照。我正在根据这样的信号制作快照:
Image {
onStatusChanged: {
if (status == Image.Ready) {
snapshotter.makeSnapshot();
}
}
}
这只是一个整体背景。我现在不会 post 一个测试用例,因为它是一个大应用程序而且我还没有隔离一个测试用例。对于以后的问题,这可能是 material。
所以我还没有问 "where's the bug in my code"。相反,我有一个简单的问题,我认为它可以帮助我修复错误:
物品重绘完成后我能收到通知吗?
理由:也许当我得到 status == Image.Ready
时,图像仅 加载 并且尚未将加载的数据绘制到屏幕外表面。因此,如果我想要的信号存在,我可以挂接到 it 而不是挂接到 Image.statusChanged
.
注意: 我可以实现自己的 NotifyingImage
组件,它的工作方式与 Image
类似,但另外公开了一个 repainted
信号。但是我想知道是否有内置的方法。
相关问题:“Get notified when QQuickItem will need updating”。但是询问者对知道项目 data 何时更新感到满意,我问的是 repainted
信号,这是 以后发生的事情 比他要求的要多。
据我所知,Window
总是作为一个整体呈现。所以你可以使用 Window
的 afterRendering
信号。
缺点:当 window 中的任何内容发生变化时,它都会被触发。但结合 (status == Image.Ready)
它可能适合你。
编辑:
blog post, announcing the release of Qt5.8
Qt Companies CTO 写道:
In addition, the scene graph now supports partial updates to the screen if only a small area of the scenography changed. This brings some larger performance improvements to the Qt Quick 2D renderer.
我不知道信号 afterRendering
的实现细节,所以我无法判断这是否是在这样的 部分更新 之后触发的,如果是的话,如何判断,那部分更新是否涉及你感兴趣的那部分。
我正在制作一个项目的快照(通过 ShaderEffectSource
和 live: false
),但有时(200 个案例中有 1 个)我得到一个空白快照。我正在根据这样的信号制作快照:
Image {
onStatusChanged: {
if (status == Image.Ready) {
snapshotter.makeSnapshot();
}
}
}
这只是一个整体背景。我现在不会 post 一个测试用例,因为它是一个大应用程序而且我还没有隔离一个测试用例。对于以后的问题,这可能是 material。
所以我还没有问 "where's the bug in my code"。相反,我有一个简单的问题,我认为它可以帮助我修复错误:
物品重绘完成后我能收到通知吗?
理由:也许当我得到 status == Image.Ready
时,图像仅 加载 并且尚未将加载的数据绘制到屏幕外表面。因此,如果我想要的信号存在,我可以挂接到 it 而不是挂接到 Image.statusChanged
.
注意: 我可以实现自己的 NotifyingImage
组件,它的工作方式与 Image
类似,但另外公开了一个 repainted
信号。但是我想知道是否有内置的方法。
相关问题:“Get notified when QQuickItem will need updating”。但是询问者对知道项目 data 何时更新感到满意,我问的是 repainted
信号,这是 以后发生的事情 比他要求的要多。
据我所知,Window
总是作为一个整体呈现。所以你可以使用 Window
的 afterRendering
信号。
缺点:当 window 中的任何内容发生变化时,它都会被触发。但结合 (status == Image.Ready)
它可能适合你。
编辑:
blog post, announcing the release of Qt5.8
Qt Companies CTO 写道:
In addition, the scene graph now supports partial updates to the screen if only a small area of the scenography changed. This brings some larger performance improvements to the Qt Quick 2D renderer.
我不知道信号 afterRendering
的实现细节,所以我无法判断这是否是在这样的 部分更新 之后触发的,如果是的话,如何判断,那部分更新是否涉及你感兴趣的那部分。