ParticleSystem greatlty consumes CPU when window is covered by other window
-
I used ParticleSystem in my QtQuick2 program. Normally it has 2% CPU usage. It's okay. But when I move another window to completely cover my QtQuick2 window (which used ParticleSystem), the process uses 25% CPU at once. I use a quad-core CPU, so 25% CPU looks like the program running in a dead loop.
As long as the QtQuick2 window is not completely covered by the other window, the CPU usage will not rise.
Is it a bug of Qt? Or there's some property to control this?
It's easy to reproduce, all my program using ParticleSystem have the same problem, as well as the examples in Qt folders.
Below is my code:
@
import QtQuick 2.0
import QtQuick.Particles 2.0Rectangle {
width: 1000
height: 800
color: "grey"ParticleSystem{
id: particles
}
ImageParticle{
anchors.fill: parent
system: particles
source: "pics/particle.png"
colorVariation: 0.6
}Emitter{
anchors.fill: parent
system: particles
emitRate: 5
lifeSpan: 2000
size: 5
sizeVariation: 2acceleration: AngleDirection { angle: 90; angleVariation: 360; magnitude: 20; }
velocity: AngleDirection { angle: -90; angleVariation: 360; magnitude: 10; }
}
}
@I'm on Windows XP, use the default Qt5.0.1 binary in "DOWNLOADS" page (so I use ANGLE).
BTW,
In order to avoid high CPU usage, I use a timer repeatedly calling QWindow::isActive(). If it's inactive, then I paused the particle system. But it's not precise. A property indicates whether the window is totally unseen would meet my needs, but I didn't find it in the documents.