[SOLVED] Strange problem with resource file



  • If I use absolute path to a file on the disk, the code is working:

    @kick = new QSound("c:/wav/Kick.wav");@

    But if I add the file to a .qrc resource the following line is not working:

    @ kick = new QSound(":/wav/Kick.wav");@

    The file is definitely added to the .qrc, with the right prefix, but instead of the expected wav sound I hear a system exclamation. The file is copied in the program root folder, and the .qrc code seems ok:

    @<RCC>
    <qresource prefix="/wav">
    <file>Kick.wav</file>
    </qresource>
    </RCC>@

    Why isn't it working?



  • What does ... say?
    @
    qDebug() << QFile::exists(":/wav/Kick.wav");
    @



  • Quote from docs:

    bq. Note that QSound does not support resources. This might be fixed in a future Qt version.



  • For some reason I get this:
    @
    Cannot retrieve debugging output.@

    However, I used this ;) :

    @ ui->test->setVisible(!QFile::exists(":/wav/Kick.wav"));@

    and the test button disappears, meaning it returns true, the button is visible by default so hiding it means the file is there, so my bet is QSound has some problem playing from .qrc files...

    Edit: @cincirin - thanks, just saw your reply when I posted

    Edit2: Turns out QSound is a dead end, it is not even supported in Necessitas


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.