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. Save a file in the same directory as QSettings
Forum Updated to NodeBB v4.3 + New Features

Save a file in the same directory as QSettings

Scheduled Pinned Locked Moved General and Desktop
11 Posts 3 Posters 7.8k 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.
  • J Offline
    J Offline
    JulienMaille
    wrote on last edited by
    #2

    Ok I found my answer:
    @QString settingsPath = QFileInfo(settings.fileName()).absolutePath();@

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #3

      That path is usually the wrong one. Use QDesktopServices::DataLocation for such stuff!

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JulienMaille
        wrote on last edited by
        #4

        Why is this path wrong?
        On win7, qsettings are stored in appData/Roaming while QDesktopServices::DataLocation points to appData/Local

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #5

          Saving arbitrary data in a preferences folder is wrong. Such data belongs elsewhere. These methods are there for a reason.

          The problem with roaming/local on Windows 7 might be fixed in a future release. Is there a bug report open? Would be good, to brings that to the Troll's attention.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on last edited by
            #6

            What path is returned, if you sue QSettinsg with native format on windows? The settings are then stored in the registry...

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #7

              [quote author="Gerolf" date="1308499376"]What path is returned, if you sue QSettinsg with native format on windows? The settings are then stored in the registry...[/quote]

              According to API docs:

              bq. On Windows, if the format is QSettings::NativeFormat, the return value is a system registry path, not a file path.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • J Offline
                J Offline
                JulienMaille
                wrote on last edited by
                #8

                Are you sure it is a bug?
                [quote author="Volker" date="1308498317"]The problem with roaming/local on Windows 7 might be fixed in a future release. Is there a bug report open? Would be good, to brings that to the Troll's attention.[/quote]

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #9

                  Feature requests are in the "bug" tracker too :-)

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    JulienMaille
                    wrote on last edited by
                    #10

                    I can understand this. However I don't know what I should request. I just said
                    [quote author="neFAST" date="1307718701"]On win7, qsettings are stored in appData/Roaming while QDesktopServices::DataLocation points to appData/Local[/quote] but is it a bug? What should be the correct behavior?

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on last edited by
                      #11

                      [quote author="neFAST" date="1308696036"]I can understand this. However I don't know what I should request. I just said
                      [quote author="neFAST" date="1307718701"]On win7, qsettings are stored in appData/Roaming while QDesktopServices::DataLocation points to appData/Local[/quote] but is it a bug? What should be the correct behavior?[/quote]

                      I do not have an idea. I would have to read on that topic first. Maybe some googling gives you more information. Sorry that I cannot give you a more useful answer.

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      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