[Qt-interest] How to avoid absolute file locations
Brad Hards
bradh at frogmouth.net
Sat Jan 10 12:32:18 CET 2009
On Saturday 10 January 2009 03:12:42 pm Samuel G wrote:
> Embedding the file as a resource is the most promising. You are
> suggesting to replace the data file (in the example) with:
>
> const char * const MYDATA = {
> "2\n"
> "3\n"
> };
> ...
> QTextStream in(MYDATA);
>
> This is nice for icons. It is also all right for the 3D models,
> but it is a bit tedious for larger images.
This is sort-of what I meant, but the implementation is a bit different.
Qt comes with support for embedding resources (in particular, a resource
compiler that will take the path to the image and link it in, and a special
syntax for referring to linked objects). You don't have to do the data file
conversion by hand.
See http://doc.trolltech.com/4.4/resources.html
Brad
More information about the Qt-interest-old
mailing list