Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Strange problem with resource file

[SOLVED] Strange problem with resource file

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cincirin
        wrote on last edited by
        #3

        Quote from docs:

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

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved