tags:

views:

38

answers:

2

I'm using QImage.save to save an image of my OpenGL framebuffer to disk. If I just call save("plot.jpg"), I have no idea where the image ends up. It's not in the application directory. I can call save("/Users/wallacer/desktop/plot.jpg") to save the file on my desktop, but obviously that's no good for running on anyone else's machine. Is there an environment variable or something I can use to save the QImage to a known location? Or is there a way I can just save the image to the directory the application resides in?

This seems obvious, but I can't seem to find anything about choosing a save location in the docs.

Thanks!

+1  A: 

You could use QDir::homePath or QDir::home to get a relative (and IIRC, platform independent) path.

ETA: Or the applcation's current path should be in QDir::currentPath.

eldarerathis
awesome! thanks!
wallacer
A: 

Ok I feel dumb. I'm just going to use a file dialog to allow the user to select a directory to save the image file in.

wallacer