I have trouble with this simple application. It will respond very slowly (processor usage is over 90%) if I have background picture or just pure Rectangle (id: background in example bellow) before button, if I comment this background rectangle, application would react quickly, but if I add "enable.layers: true" to root item, slow response would be come back . Where is the problem?
I would like to have background picture and fast response on clicking. I am running this example on Raspberry Pi 3.
import QtQuick 2.3
Item {
id: root
visible: true
width: 800
height: 480
Rectangle {
id: background
anchors.fill: parent
smooth: true
}
Rectangle {
id: button
width: 200 ; height: 123
anchors.centerIn: parent
smooth: true
radius: 8
//color the button with a gradient
gradient: Gradient {
GradientStop {
position: 1.0
color: {
if (mouseArea.pressed)
return "red"
else
return "chartreuse"
}
}
GradientStop {position: 0.0; color: "paleturquoise" }
}
MouseArea {
id:mouseArea
anchors.fill: parent
onPressed: {
//handler.turnOn()
}
onReleased: {
// handler.turnOff()
}
}
}
}
It solved this problem with enabling experimental GL under raspi-config. Reason why QtQuick 1.1 worked OK was due this fact: "In Qt 5, all QML applications are rendered with an OpenGL scenegraph architecture rather than the Graphics View framework used in Qt 4."