Hi,
I have two images which represents the two states of a button: normal and rollover.
I put them into a resource file and this is the first try to make such a button:
Image {
source: mouseArea.containsMouse ? "qrc:///rollover.png" : "qrc:///normal.png"
anchors.horizontalCenter: parent.horizontalCenter
y: 162
Text {
anchors.centerIn: parent
font.pixelSize: 60
font.bold: true
color: "#ffffff"
text: "PRESS ME"
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
}
}
It works, but it takes few seconds to load each image (they should be cached but it takes the same time every time the mouse enters and exits).
We are talking about files of 3-4 kBytes!
What’s wrong? What’s the best way to achieve this?
↧