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. [SOLVED] best method to save data on users computer
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] best method to save data on users computer

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.5k 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.
  • T Offline
    T Offline
    Timmoth
    wrote on last edited by
    #1

    Hi, i need to save a few different lists to a users computer which has not got admin privileges.

    (the lists are of a custom data type called media and contains fields such as the name, path, size, duration ect.)

    im wondering what the fastest and most robust way to save data on the users computer would be without any administrator rights.
    at the moment im thinking the solutions are XML or SQL, however i have no idea which is more suited to my purpose.

    thanks for any suggestions.

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

      Hi,

      Is only your application using these data ?

      If so you have "QDesktopServices::storageLocation":http://qt-project.org/doc/qt-4.8/qdesktopservices.html#storageLocation for Qt 4 and "QStandardPaths::writableLocation":http://qt-project.org/doc/qt-5.0/qtcore/qstandardpaths.html#writableLocation for Qt 5

      Database or XML depends essentially on the structure of the data. You can also use SQLite to avoid installing a database server

      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
      • X Offline
        X Offline
        xcoder
        wrote on last edited by
        #3

        Hello,

        In my opinion the fastest way for sure would be to use XML.
        I personally tend to use XML if data needs to be stored locally for a user.
        But SQL when the data needs to be shared between multiple users over network, but I have to yet use SQL with Qt. Anyway, I would go for XML, more or less easy to use and good for storing multiple lists.

        Only a biker knows why a dog sticks his head out of a car window.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          Timmoth
          wrote on last edited by
          #4

          thanks for the reply - SQLite sounds like a viable solution.

          yes its only my application.

          my data structure is of this format:
          @
          struct Point
          {
          QString name;
          QString path;
          QString notes
          };
          @

          1 Reply Last reply
          0
          • T Offline
            T Offline
            Timmoth
            wrote on last edited by
            #5

            just a quick question - if i do use XML xcoder. in Windows where should i store the XML file?

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

              The same place you would save the database, in the folder returned for DataLocation since it's specific for your software

              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
              • T Offline
                T Offline
                Timmoth
                wrote on last edited by
                #7

                ok cheers SGalst - im going to use XML and save to
                @
                QString dataDirectory = QStandardPaths::writableLocation(QStandardPaths::DataLocation);--@

                one more thing, once i have read the contents of the XML file into memory where can i store the data so that it can be accessed through out my program (like from within my custom widgets and also from my mainwindow)

                should i make a static 'data' class?

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

                  Then I would go for the Model/View paradigm, create one model with your data and make your widget act like "views" on that model

                  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

                  • Login

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