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. What are the benefits of QSettings class?
Qt 6.11 is out! See what's new in the release blog

What are the benefits of QSettings class?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 1.9k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    mikecurl91
    wrote on last edited by
    #1

    hi,

    i've seen in a lot of application that the developer uses a QSettings class form store some information.
    from the reference of the class, i've read in the description that it is a platform indipendent machanism to store information.
    I've not understand what it means: how can I use it in a application? Closing the application all data are lost?
    What could be an example of use? thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      As the name suggest, QSettings allows you to store settings for your application. i.e a window position, the value of a QComboBox or whatever you would like to store/restore when you close/restart your application.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pkj__
        wrote on last edited by
        #3

        "QSettings documentation":http://qt-project.org/doc/qt-5.0/qtcore/qsettings.html

        This is detailed enough. QSettings can be used more easily application wide. Even if going for a file rather than say registry entry, the normal serialization procedure involving QDataStream, etc, is very easily broken if not designed right. Using sqllite as a database is too complex for most application users.
        QSettings provides a tree level variant based storing mechanism without file stream order worries or details of sqllite db.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mikecurl91
          wrote on last edited by
          #4

          Thank you so much.
          My doubt is also about how it is performed: where these data are stored?
          I think in a file, but where is located this file?
          tnk
          [quote author="SGaist" date="1377100862"]Hi,

          As the name suggest, QSettings allows you to store settings for your application. i.e a window position, the value of a QComboBox or whatever you would like to store/restore when you close/restart your application.

          Hope it helps[/quote]

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            [quote author="mikecurl91" date="1377101060"]where these data are stored?
            I think in a file, but where is located this file?
            [/quote]

            It depends on the OS. On windows either in the good old ini-file or in the registry. Checkout the "documentation on the specifics.":http://qt-project.org/doc/qt-5.0/qtcore/qsettings.html#platform-specific-notes

            [quote author="mikecurl91" date="1377101060"]
            My doubt is also about how it is performed
            [/quote]
            the ini-file mode it is ASCII. There are certainly faster ways to do. However, in general it is not really an issue, since it is not supposed to store MB to GB of data.

            Vote the answer(s) that helped you to solve your issue(s)

            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