How can I create our configuration file?
-
wrote on 22 Jan 2021, 13:07 last edited by
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
-
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
wrote on 22 Jan 2021, 13:13 last edited by JonB@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
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.
wrote on 22 Jan 2021, 13:21 last edited by@JonB Thank you for answer. Is there any resource you can suggest me for creating config file with JSON?
-
@JonB Thank you for answer. Is there any resource you can suggest me for creating config file with JSON?
-
wrote on 22 Jan 2021, 13:39 last edited by
@jsulm Thank you.
-
wrote on 25 Jan 2021, 07:14 last edited by
@jsulm Hi. Is there any way to convert my classes into json file?
How can i write all of them as a JSON file, i did not understand actually -
@jsulm Hi. Is there any way to convert my classes into json file?
How can i write all of them as a JSON file, i did not understand actually@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?:
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.htmlwrote on 25 Jan 2021, 07:27 last edited by@jsulm yes I've. I want to ask one question too. Can i read data which are coming from usb, that is created as a config file with JSON
-
@jsulm yes I've. I want to ask one question too. Can i read data which are coming from usb, that is created as a config file with JSON
@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?
-
@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?
wrote on 25 Jan 2021, 07:32 last edited by deleted286@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? -
@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 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.
wrote on 25 Jan 2021, 07:37 last edited by@jsulm it is GPS. I will get some daha from GPS. I read them and add into a chart. I want to read operation with a config file. Is it silly to do it this way?
-
@jsulm it is GPS. I will get some daha from GPS. I read them and add into a chart. I want to read operation with a config file. Is it silly to do it this way?
@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 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"?
wrote on 25 Jan 2021, 07:44 last edited by@jsulm it is reading
-
@jsulm it is reading
@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 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.wrote on 25 Jan 2021, 07:52 last edited by@jsulm said in
So, you read data from USB and want to do it via a config file - this does not make sense to me, sorry.
Im asking it. In which case can i use config file?
-
@jsulm said in
So, you read data from USB and want to do it via a config file - this does not make sense to me, sorry.
Im asking it. In which case can i use config file?
wrote on 25 Jan 2021, 08:25 last edited by JonB@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.
-
@jsulm said in
So, you read data from USB and want to do it via a config file - this does not make sense to me, sorry.
Im asking it. In which case can i use config 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...
-
@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...
wrote on 25 Jan 2021, 08:42 last edited by@jsulm Ok. Thank you for your answers.
1/19