[Qt-interest] Playing files from resource files
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Tue Dec 16 18:28:02 CET 2008
Tiago Correia wrote on Tuesday, December 16, 2008 3:33 PM:
> Hi again,
>
> I'm using Visual Studio 2005 Professional for compiling with the
> commercial version, plus the Visual Studio Integration. MAybe there
> is a problem in linking, but the resource file is indeed compiled.
>
> Maybe I'll try to do a file listing of the ":/" folder. I guess it
> should be possible. I'll post my tries later.
Try opening the generated qtc_[YourResourceFile].cpp and look for
static const unsigned char qt_resource_struct[] = {
...
}
Inside this struct there should be (generated) comments with the resource paths you'd have to use within your code, e.g.
// :/Project/img/ApplicationIcon32x32.png
This was generated from a *.qrc file with
<RCC>
<qresource prefix="/Project" >
<file>img/ApplicationIcon32x32.png</file>
</qresource>
</RCC>
So I would use it as:
QPixmap icon(":/Project/img/ApplicationIcon32x32.png");
But I noted this other thread "using resources in phonon", too, so there might be a different problem with "resources & phonon".
By the way, from your original post I understand that you didn't even succeed in filling the QBuffer, given the QFile reading from the resource, right? So it is still a "resource" problem, right?
Did you try to use a QByteArray (non-buffered data) instead? Or does the Phonon API really require a QBuffer? Maybe "buffering" data from a Qt resource (*.qrc) really doesn't work well... and just now somewhere in my brain there is a little XMas jingle bell ringing, indicating that there has been a discussion about this already here on qt-interest ("Phonon and embedded resources" or so...).
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list