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

QSettings

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 899 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.
  • S Offline
    S Offline
    satyanarayana143
    wrote on 5 Nov 2019, 05:29 last edited by
    #1

    hi freinds i want write array of json value to QSettings ini file
    below example
    [ "ID": 570, "picture": "03803.png", "name": "Bob"]

    how to write to QSettings file. any example

    J B J 3 Replies Last reply 5 Nov 2019, 05:37
    0
    • S satyanarayana143
      5 Nov 2019, 05:29

      hi freinds i want write array of json value to QSettings ini file
      below example
      [ "ID": 570, "picture": "03803.png", "name": "Bob"]

      how to write to QSettings file. any example

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 5 Nov 2019, 05:37 last edited by
      #2

      @satyanarayana143 said in QSettings:

      any example

      Read documentation, there are examples: https://doc.qt.io/qt-5/qsettings.html
      Also, QSettings does not use JSON format.

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

      1 Reply Last reply
      5
      • S satyanarayana143
        5 Nov 2019, 05:29

        hi freinds i want write array of json value to QSettings ini file
        below example
        [ "ID": 570, "picture": "03803.png", "name": "Bob"]

        how to write to QSettings file. any example

        B Offline
        B Offline
        beecksche
        wrote on 6 Nov 2019, 06:51 last edited by beecksche 11 Jun 2019, 06:51
        #3

        @satyanarayana143

        You may want to save a QJsonDocument

        1 Reply Last reply
        0
        • S satyanarayana143
          5 Nov 2019, 05:29

          hi freinds i want write array of json value to QSettings ini file
          below example
          [ "ID": 570, "picture": "03803.png", "name": "Bob"]

          how to write to QSettings file. any example

          J Offline
          J Offline
          JonB
          wrote on 6 Nov 2019, 09:13 last edited by
          #4

          @satyanarayana143
          For an example of how to save JSON via QSettings you might read through https://stackoverflow.com/questions/42060573/save-ui-settings-with-qsettings-or-qjson.

          There are known issues with QSettings which might occur with a JSON entry. Also, your JSON will probably have newlines in it, I don't know whether QSettings handles this for you (I think settings entries in the file have to be on one line), and/or "special" characters in the JSON which just might trip QSettings up.

          If it all works as-is, fine. If not, just be aware that you could always use https://doc.qt.io/qt-5/qbytearray.html#toBase64 to encode the JSON before saving, and https://doc.qt.io/qt-5/qbytearray.html#fromBase64 to decode upon reload, if required and that solves issues.

          1 Reply Last reply
          1

          1/4

          5 Nov 2019, 05:29

          • Login

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