How can I create our configuration file?
-
Hi everyone. I want to create a configuration file for my own app. For storing everything there and do some operations with it. What is the best way for doing it?
What should i use for doing such a thing? JSON or XML or anything else?
Does QT support such thing?Thank you
-
@suslucoder
You can indeed. Most things these days use JSON.But before you write your own configuration file, at least read Qt's QSettings and see whether that would serve you sufficiently. It saves you doing a lot of work, and handles the configuration file location/writing/reading for you. If you need to, you can even make any of the key/values store a JSON string (suitably encoded) for the value, if it's especially complex. However, if your JSON configuration settings are large it may not be ideal.
-
-
@suslucoder said in How can I create our configuration file?:
How can i write all of them as a JSON file
This is your job. There is no generic way.
In the link I gave you before there is a link to an example - did you check it?
https://doc.qt.io/qt-5/qtcore-serialization-savegame-example.html -
@suslucoder said in How can I create our configuration file?:
Can i read data which are coming from usb
In what way "coming from usb"? Do you mean you have a disk connected via USB containing a JSON file? If so, then sure, why not?
-
@jsulm Nope.
I want to read some daha and chart it. The datas comes me via some USB ports.(I hope I can explain properly)
I thought that, doing it with a config file might make more sense. And for doing it, i should create my own config file, using JSON. Right? -
@suslucoder Sorry, I don't understand. Do you read some data from some device connected via USB? If so - what device is that and what does it actually send? And what does your config file have to do with that USB device? Please explain clearly your use case.
-
@suslucoder said in How can I create our configuration file?:
I want to read operation with a config file
What does this mean? What is "operation"?
-
@suslucoder Sorry, I still fail to understand you.
"I want to read operation with a config file" - please explain clearly what you mean here.
This is your post from before:
"I want to read some daha and chart it. The datas comes me via some USB ports.(I hope I can explain properly)
I thought that, doing it with a config file might make more sense."
So, you read data from USB and want to do it via a config file - this does not make sense to me, sorry. Can you previde an example of the config file, that could help to understand what you want to do. -
@suslucoder
As @jsulm has said, nobody understands what you are saying/asking.In any case, you read whatever from USB. That data either is or is not in JSON or in config file format or whatever. And that's what you have to work with. The fact of USB or not is neither here nor there. It's just a stream of data/file.
-
@suslucoder said in How can I create our configuration file?:
In which case can i use config file?
In case you have or need a config file of course! Sorry I really don't understand what you are asking...