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
QtWS25 Last Chance

QSettings

Scheduled Pinned Locked Moved General and Desktop
problemqsettingslinuxwindows
8 Posts 3 Posters 2.3k 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.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #1
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Laky
      Impossible to say if you show no code.

      Have you tried
      qDebug() << settings.fileName();

      to see if path still valid on windows?

      if you have something like
      QSettings settings("/home/petra/misc/myapp.ini")
      that could be the issue.

      L 1 Reply Last reply
      0
      • mrjjM mrjj

        @Laky
        Impossible to say if you show no code.

        Have you tried
        qDebug() << settings.fileName();

        to see if path still valid on windows?

        if you have something like
        QSettings settings("/home/petra/misc/myapp.ini")
        that could be the issue.

        L Offline
        L Offline
        Laky
        wrote on last edited by
        #3

        @mrjj https://github.com/DenisLaky/LIGHT_IT_NOTES/blob/master/ManagerOFNotes/mainwindow.cpp

        mrjjM 1 Reply Last reply
        0
        • L Laky

          @mrjj https://github.com/DenisLaky/LIGHT_IT_NOTES/blob/master/ManagerOFNotes/mainwindow.cpp

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Laky
          seems ok. It does work on linux ?

          How do you initialize mainSettings ?

          L 2 Replies Last reply
          0
          • mrjjM mrjj

            @Laky
            seems ok. It does work on linux ?

            How do you initialize mainSettings ?

            L Offline
            L Offline
            Laky
            wrote on last edited by Laky
            #5

            @mrjj Yes,it work. https://github.com/DenisLaky/LIGHT_IT_NOTES/blob/master/ManagerOFNotes/mainwindow.h

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mcosta
              wrote on last edited by mcosta
              #6

              Hi,

              I don't know if is a problem but why do you use / as key prefix??
              Windows writes settings in the Registry.

              Also I don't know why you use members objects for QSettings

              Once your problem is solved don't forget to:

              • Mark the thread as SOLVED using the Topic Tool menu
              • Vote up the answer(s) that helped you to solve the issue

              You can embed images using (http://imgur.com/) or (http://postimage.org/)

              L 1 Reply Last reply
              0
              • M mcosta

                Hi,

                I don't know if is a problem but why do you use / as key prefix??
                Windows writes settings in the Registry.

                Also I don't know why you use members objects for QSettings

                L Offline
                L Offline
                Laky
                wrote on last edited by
                #7

                @mcosta How i can do correctly?

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mcosta
                  wrote on last edited by
                  #8

                  Hi,

                  some suggestions:

                  1. Set Application Name and Organization name only once (in the main.cpp);
                  2. Create a QSettings instance when you need it; the destructor calls QSettings::sync() and all unsaved data will be saved.

                  Once your problem is solved don't forget to:

                  • Mark the thread as SOLVED using the Topic Tool menu
                  • Vote up the answer(s) that helped you to solve the issue

                  You can embed images using (http://imgur.com/) or (http://postimage.org/)

                  1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @Laky
                    seems ok. It does work on linux ?

                    How do you initialize mainSettings ?

                    L Offline
                    L Offline
                    Laky
                    wrote on last edited by Laky
                    #9

                    @mrjj "/home/denis/.config/newCompany/NotesManager.conf".It is path in Linux.
                    "\HKEY_CURRENT_USER\Software\newCompany\NotesManager in windows

                    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