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. Configuration file
QtWS25 Last Chance

Configuration file

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 5 Posters 563 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.
  • G Offline
    G Offline
    GrahamLa
    wrote on last edited by
    #1

    Hi
    I need to have some sort of configuration file that can be edited by a user.
    The configuration file will contain groupings of items for example

        PrintButton:
            Visible: true,
            AsPng: true,
            ForcePdf: false,
            GrayScale: false
    
    

    Has anyone got any ideas on how best to achieve this?

    Pablo J. RoginaP 1 Reply Last reply
    0
    • G GrahamLa

      Hi
      I need to have some sort of configuration file that can be edited by a user.
      The configuration file will contain groupings of items for example

          PrintButton:
              Visible: true,
              AsPng: true,
              ForcePdf: false,
              GrayScale: false
      
      

      Has anyone got any ideas on how best to achieve this?

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @GrahamLa you may want to take a look at the QSettings class, which "provides persistent platform-independent application settings"

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      5
      • ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote on last edited by
          #4

          You might also look at JSON. I've found it to be very flexible for storing configuration entries and groups of configuration profiles.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            Daniel Williams
            wrote on last edited by
            #5

            I've used the QSetttings class, too. It's very well done. You can instantiate an object QSettings qs("organization", "application") which basically groups the settings in a config file. On linux the file is stored at ~/.config/organization/appliction.conf. Then there are calls to read/write to the file. Try it, you'll like it ;)

            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