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 access issue

QSettings access issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 617 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.
  • J Offline
    J Offline
    junzhe fan
    wrote on last edited by
    #1

    Hi
    I am using QSettings class to configure my applications' startup behavior under Windows OS, but my application won't load the INI file unless I run my app as administrator. I am not sure if this is a system security level issue or I have to configure my APP somehow to let OS trust my application? Thanks for the help.

    artwawA 1 Reply Last reply
    0
    • J junzhe fan

      Hi
      I am using QSettings class to configure my applications' startup behavior under Windows OS, but my application won't load the INI file unless I run my app as administrator. I am not sure if this is a system security level issue or I have to configure my APP somehow to let OS trust my application? Thanks for the help.

      artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #2

      @junzhe-fan Where is the ini file located? If together with executable OS will not allow access. Please consider QStandardPaths which are OS aware and point to safe locations.

      For more information please re-read.

      Kind Regards,
      Artur

      1 Reply Last reply
      2
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3

        Where is your app located? That dir may be a better place to save the file because it goes with your app. In other dirs, this file could be cleaned up by accident.

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

          @artwaw said in QSettings access issue:

          QStandardPaths

          @artwaw Hi it in C:\Program Files folder and under the same dirctory as my exe file

          artwawA JonBJ 2 Replies Last reply
          0
          • J junzhe fan

            @artwaw said in QSettings access issue:

            QStandardPaths

            @artwaw Hi it in C:\Program Files folder and under the same dirctory as my exe file

            artwawA Offline
            artwawA Offline
            artwaw
            wrote on last edited by
            #5

            @junzhe-fan You should:

            1. read the documentation to QStandardPaths;
            2. having read that, please consider using location pointed by QStandardPaths::AppConfigLocation.

            For more information please re-read.

            Kind Regards,
            Artur

            JoeCFDJ 1 Reply Last reply
            4
            • artwawA artwaw

              @junzhe-fan You should:

              1. read the documentation to QStandardPaths;
              2. having read that, please consider using location pointed by QStandardPaths::AppConfigLocation.
              JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by JoeCFD
              #6

              @artwaw QStandardPaths::AppConfigLocation is the optimal one.

              1 Reply Last reply
              0
              • J junzhe fan

                @artwaw said in QSettings access issue:

                QStandardPaths

                @artwaw Hi it in C:\Program Files folder and under the same dirctory as my exe file

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #7

                @junzhe-fan said in QSettings access issue:

                Hi it in C:\Program Files folder and under the same dirctory as my exe file

                Just so you know. Used to be fine years ago. Now C:\Program Files\... (and the (x86) one) are no longer writable by users without admin elevation as a security guard. QSettings by default accesses .ini file for write as well as read, assuming you want to allow settings to be altered by user (do you?). So that's why it's best for you to put the file elsewhere and presumably causes your error situation. Much better than raising elevation on your program to permit it to write there.

                Or let QSettings use its default behaviour of using the Windows Registry, then this would not be an issue....

                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