Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I create our configuration file?
Forum Updated to NodeBB v4.3 + New Features

How can I create our configuration file?

Scheduled Pinned Locked Moved Unsolved General and Desktop
config fileqt5json
19 Posts 3 Posters 4.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JonBJ 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.

    D Offline
    D Offline
    deleted286
    wrote on last edited by
    #3

    @JonB Thank you for answer. Is there any resource you can suggest me for creating config file with JSON?

    jsulmJ 1 Reply Last reply
    0
    • D deleted286

      @JonB Thank you for answer. Is there any resource you can suggest me for creating config file with JSON?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @suslucoder https://doc.qt.io/qt-5/json.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 2 Replies Last reply
      0
      • jsulmJ jsulm

        @suslucoder https://doc.qt.io/qt-5/json.html

        D Offline
        D Offline
        deleted286
        wrote on last edited by
        #5

        @jsulm Thank you.

        1 Reply Last reply
        0
        • jsulmJ jsulm

          @suslucoder https://doc.qt.io/qt-5/json.html

          D Offline
          D Offline
          deleted286
          wrote on last edited by
          #6

          @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

          jsulmJ 1 Reply Last reply
          0
          • D deleted286

            @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

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #7

            @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

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            D 1 Reply Last reply
            0
            • jsulmJ jsulm

              @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

              D Offline
              D Offline
              deleted286
              wrote on last edited by
              #8

              @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

              jsulmJ 1 Reply Last reply
              0
              • D deleted286

                @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

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #9

                @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?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                D 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @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?

                  D Offline
                  D Offline
                  deleted286
                  wrote on last edited by deleted286
                  #10

                  @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?

                  jsulmJ 1 Reply Last reply
                  0
                  • D 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?

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    @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.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    D 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @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.

                      D Offline
                      D Offline
                      deleted286
                      wrote on last edited by
                      #12

                      @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?

                      jsulmJ 1 Reply Last reply
                      0
                      • D deleted286

                        @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?

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #13

                        @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"?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        D 1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @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"?

                          D Offline
                          D Offline
                          deleted286
                          wrote on last edited by
                          #14

                          @jsulm it is reading

                          jsulmJ 1 Reply Last reply
                          0
                          • D deleted286

                            @jsulm it is reading

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #15

                            @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.

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            D 1 Reply Last reply
                            1
                            • jsulmJ jsulm

                              @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.

                              D Offline
                              D Offline
                              deleted286
                              wrote on last edited by
                              #16

                              @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?

                              JonBJ jsulmJ 2 Replies Last reply
                              0
                              • D deleted286

                                @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?

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by JonB
                                #17

                                @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.

                                1 Reply Last reply
                                2
                                • D deleted286

                                  @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?

                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #18

                                  @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...

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  D 1 Reply Last reply
                                  1
                                  • jsulmJ jsulm

                                    @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...

                                    D Offline
                                    D Offline
                                    deleted286
                                    wrote on last edited by
                                    #19

                                    @jsulm Ok. Thank you for your answers.

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved