[Qt-interest] How to avoid absolute file locations
Brad Hards
bradh at frogmouth.net
Sat Jan 10 03:51:37 CET 2009
On Saturday 10 January 2009 12:47:22 pm Samuel G wrote:
> With the two files above, opening the file fails on line 8. What is
> the Qt way to read program data without using an absolute file
> location?
I think it depends on what you are trying to do. There isn't a "best" answer
that doesn't depend on the context (e.g. whether this is a test app, a
command line of GUI tool, who the users are and how they will use the
application).
The most Qt-way I can think of would be to have a GUI to select the file from
the file system.
Other options would be to use a configuration file, or to pass the file name
(and path, if necessary) on the command line, or to embed the file as a
resource.
Brad
More information about the Qt-interest-old
mailing list