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
Forum Update on Monday, May 27th 2025

Configuration file

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 5 Posters 575 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 28 Feb 2019, 16:45 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?

    P 1 Reply Last reply 28 Feb 2019, 16:48
    0
    • G GrahamLa
      28 Feb 2019, 16:45

      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?

      P Offline
      P Offline
      Pablo J. Rogina
      wrote on 28 Feb 2019, 16:48 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
      • O Offline
        O Offline
        ODБOï
        wrote on 28 Feb 2019, 17:33 last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • K Offline
          K Offline
          Kent-Dorfman
          wrote on 28 Feb 2019, 21:04 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 28 Feb 2019, 22:25 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

            4/5

            28 Feb 2019, 21:04

            • Login

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