QSound::play("soundpath") call works but a QSound object doesn't

848 views Asked by At

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.

0

There are 0 answers