Absolute Path:
App.applicationdirpath (): This gets is an absolute path, is the absolute path when the program runs, if is debug mode, absolute path locates to debug file
Qdir::currentpath (); This gets the absolute path to the working directory. Click Run in the project to get the path set below. But if you are running directly on debug, you get the path to the current program.
relative path:
We usually use "./" and ":/". First, let's take a look at "./".
“./”:
The first thing we have to consider is which path is this relative, and this is the path to the working directory, which is Qdir::currentpath ().
Note: The path of Qdir::currentpath () will change, if the project is the path of the engineering directory, if it is not the project, direct operation, get the path of the program, so generally do not use "./" To obtain the path, this time can be loaded with QT QRC. Let's take a look at the following ":/".
":/": This is relatively simple, is QRC inside the path plus ":/" just fine. The following figure, I can use this:
Qfile f (":/gui/stylesheets/black.css");