How to read a json file without using the qrc ?
-
I just want to load some json data from the files.But I dont want the user read the json file,so is there any ways that could load the json file from the dll or something else?
-
I don't understand your question. What files, what DLL? What JSON and what do you want it to do with it?
If you supply a file which the program needs to read but the user does not then putting it into the executable as a Qt resource seems an excellent way. It already does that when you use
qrc:/...
as a file path, so I don't understand why you are asking not to use it, seems the opposite of what you want?If you want to supply files externally then you won't use Qt resources/
qrc
, you can load them with code. There are Qt classes for reading JSON data. -
@nicker-player
Simply create a string variable with your json contents in any file you want.