Quote Originally Posted by DDDIM View Post
A program should not have these strange behaviour and slowly consume CPU. I could understand if it were RAM consumption, but this CPU consumption is very strange.
You are constantly triggering CPU bound operations, why are you expecting the program to not use CPU?

Data in a Qt resource is compressed, loading requires decompression (CPU bound operation 1).
The image format might not be simple bitmap, loading requires decodign (CPU bound operation 2).
Decoded image data might not have the same channel setup as the display, loading requires conversion (CPU bound operation 3, though some of that might be delegated to the GPU).

Destroying and creating image buffers usually also requires CPU involvment.

Try loading both images into one Image element each, and then switching visibiliy

Qt Code:
  1. Window{ height: 100; width: 100; visible: true; objectName: "w1"; id:w1;
  2. Image{anchors.fill: parent; visible: sw; source: "qrc:/images/1"; }
  3. Image{anchors.fill: parent; visible: !sw; source: "qrc:/images/2"; }
  4. }
To copy to clipboard, switch view to plain text mode 

Cheers,
_