Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Where can I find QML Settings file or where is it saved in my device?
Forum Updated to NodeBB v4.3 + New Features

Where can I find QML Settings file or where is it saved in my device?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
9 Posts 4 Posters 5.5k Views 3 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.
  • E Offline
    E Offline
    emmericatto
    wrote on last edited by
    #1

    I am using QtCreator for a C++/QML application on RaspberryPi. I want to save some application settings and I reached this goal using a code that is very similar to the documentation at this link.

    ...
    import Qt.labs.settings 1.0
    
    Settings {
    id: settingsValues
    property int sliderValue: 300000
    property bool checkBoxChecked: true
     }
    ...
    

    Question:

    Where can I find the file in which these values are stored?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Charlie_Hdz
      wrote on last edited by
      #2

      This might work:

      The actual mechanism for the persistent storage of QSettings data is implementation-
      dependent and quite flexible. Some possibilities for its storage include the Win32 reg-
      istry (in Windows) and your $HOME/.settings directory (in Linux).

      Kind Regards,
      Enrique Hernandez
      gearstech.com.mx
      chernandez@gearstech.com.mx

      E 1 Reply Last reply
      0
      • C Charlie_Hdz

        This might work:

        The actual mechanism for the persistent storage of QSettings data is implementation-
        dependent and quite flexible. Some possibilities for its storage include the Win32 reg-
        istry (in Windows) and your $HOME/.settings directory (in Linux).

        E Offline
        E Offline
        emmericatto
        wrote on last edited by
        #3

        @Charlie_Hdz I have a .config directory in my Linux OS but there is nothing inside related to Qt or Qml. How can I set the folder where I would like to save this persistent storage?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Charlie_Hdz
          wrote on last edited by
          #4

          Had you set values like this way?

          settings.setValue("pos", pos());
          settings.setValue("size", size());
          settings.setValue("state", saveState());
          

          Kind Regards,
          Enrique Hernandez
          gearstech.com.mx
          chernandez@gearstech.com.mx

          E 1 Reply Last reply
          0
          • C Charlie_Hdz

            Had you set values like this way?

            settings.setValue("pos", pos());
            settings.setValue("size", size());
            settings.setValue("state", saveState());
            
            E Offline
            E Offline
            emmericatto
            wrote on last edited by
            #5

            @Charlie_Hdz No, I have set the values only in the .qml where I needed. For the settings I have not written qml code in .cpp file, I have used the structure shown in the question above.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Charlie_Hdz
              wrote on last edited by
              #6

              In some way, you need to write those settings after the user wants to quit but before the window is
              closed. Can you trigger a QML signal to catch them in the .cpp file?

              Kind Regards,
              Enrique Hernandez
              gearstech.com.mx
              chernandez@gearstech.com.mx

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

                Hi,

                The paths are described here.

                The Settings QML object is based on QSettings no need to try to pass stuff around between QML and cpp.

                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
                2
                • E Offline
                  E Offline
                  emmericatto
                  wrote on last edited by
                  #8

                  I am using QtCreator on Ubuntu 16.04, so I found the configuration file at the following path:

                  default_Directory_Of_My_Project/.config/Unknown Organization/myProject.conf

                  jpnurmiJ 1 Reply Last reply
                  0
                  • E emmericatto

                    I am using QtCreator on Ubuntu 16.04, so I found the configuration file at the following path:

                    default_Directory_Of_My_Project/.config/Unknown Organization/myProject.conf

                    jpnurmiJ Offline
                    jpnurmiJ Offline
                    jpnurmi
                    wrote on last edited by
                    #9

                    @emmericatto set the application name and organization: http://doc.qt.io/qt-5/qml-qt-labs-settings-settings.html#application-identifiers

                    1 Reply Last reply
                    2

                    • Login

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