Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, February 2007
managing QT resource at run-time


Message 1 in thread

How to insert some file into current qt-resource at run time?

I have xml file which holds it's pictures inside binary tag, like this:
<binary content-type="image/jpeg" id="cover.jpg">/9j/4AAQ......SkZJ</binary>
in xml itself, this picture is shown by tag <image l:href="#cover.jpg"/>.
I want to put reconstracted jpeg into QT-resource tree and show this xml in
QTextBrowser with modifictation of image tag to <image
l:href=":/document/cover.jpg"/>.
So the question is how to put some chunk of binary data into qt-resource
tree as a virtual file?


--
 [ signature omitted ] 

Message 2 in thread

George Brink wrote:

> So the question is how to put some chunk of binary data into qt-resource
> tree as a virtual file?

Take a look at the QResource class in Qt 4.2:

  http://doc.trolltech.com/4.2/qresource.html

David

--
 [ signature omitted ] 

Message 3 in thread

It looks like QResource is useful to load a complete resource file system
from external file... And I don't get how to make such file...
But I need to add file to already existed resource FS.
Something like
    Q_INIT_RESOURCE(MyPermanentResource);
    {
        QFile *file = QFile(":/document/newfile.jpg");
        file->write(decoded_buffer, buffer_length);
        file->flush();
    }
    QLabel *label = new QLabel(this);
    QLabel->setPixmap(QPixmap(":/document/newfile.jpg"));
How to rewrite file creating block to make this program work?
Any example code would be much appreciated.

"David Boddie" <dboddie@xxxxxxxxxxxxx> wrote in message
news:epvgg7$bsv$2@xxxxxxxxxxxxxxxxxxxxx
> George Brink wrote:
>
> > So the question is how to put some chunk of binary data into qt-resource
> > tree as a virtual file?
>
> Take a look at the QResource class in Qt 4.2:
>
>   http://doc.trolltech.com/4.2/qresource.html
>
> David


--
 [ signature omitted ]