November 2014
Beginner to intermediate
264 pages
5h 32m
English
Qt Quick provides the SoundEffect type to play short sound effects with a minimum latency. This is especially good for things such as button click sounds, virtual keyboard sounds, and alert tones as part of a rich and engaging multimedia experience. Using it is straightforward; you provide the type with a source field and call its play method to start the playback, as follows:
import QtQuick 2.3
import QtMultimedia 5.0
Text {
text: "Click Me!";
font.pointSize: 24;
width: 150; height: 50;
SoundEffect {
id: playSound
source: "soundeffect.wav"
}
MouseArea {
id: playArea
anchors.fill: parent
onPressed: { playSound.play() }
}
}Here, SoundEffect will play the contents of the soundeffect.wav file stored in the application's ...
Read now
Unlock full access