I am trying to play a sound with QSound module.
It try with this code and works:
QSound::play(":/sounds/sources/BeepSound.wav");
But I want this and doesn't work:
I create a dynamic instance of QSound
and played:
sounds = new QSound(":/sounds/sources/BeepSound.wav");
sounds->setLoops(3);
sounds->play();
Any tips?
Update
I don't want to use others modules like QMediaPlayer
, QAudioOutput
because I want something really simple, just play a sound.
来源:https://stackoverflow.com/questions/30812327/qsoundplaysoundpath-call-works-but-a-qsound-object-doesnt