QPixmap .png in the same project directory
I want to create a Qpixmap object with a .png that is in a subfolder within the same project directory without typing in the entire path.I think there is a way to do this. But for the life of me i cant remember.
so instead of typing
You can access the path of your application by calling applicationDirPath [doc.qt.nokia.com]
If you want the native separator of folders on your system, you have QDir::separator [doc.qt.nokia.com]
By the way, do you really need a pointer to your QPixmap ?
Otherwise, you still can use the Qt Resource System, as stated above :)
This is should work. Since you are not using the resource system, you must do one thing :) . Copy the image to build directory.
According to doc [doc.qt.nokia.com]
If fileName contains a relative path (e.g. the filename only) the relevant file must be found relative to the runtime working directory.