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 891 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 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

    jsulmJ beeckscheB JonBJ 3 Replies Last reply
    0
    • S satyanarayana143

      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

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on 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

        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

        beeckscheB Offline
        beeckscheB Offline
        beecksche
        wrote on last edited by beecksche
        #3

        @satyanarayana143

        You may want to save a QJsonDocument

        1 Reply Last reply
        0
        • S satyanarayana143

          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

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on 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

          • Login

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