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. How to deal with Data from files and widgets
Forum Updated to NodeBB v4.3 + New Features

How to deal with Data from files and widgets

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 309 Views 2 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.
  • H Offline
    H Offline
    Harsaith
    wrote on last edited by
    #1

    Hello,

    I am pretty new to qt programming and I would like to know what is the good way to do the following :

    In my application, I decided to let the user create widgets dynamically when he presses on a "Add new Widget X" button and once the widget is created, I store the data of the widget in a json file in order to be recreate the widget the next time he closes the close, then open the application.

    So far, don't have a "model" to retrieve the data. What I do is : I have a directory in which i put all of my json files for that kind of widet. I name those files like this "widgetX_1.json", "widgetX_2.json" and so on. However, this does not seem to be the propper way,

    I need some guidance please

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

      Hi,

      Is the saving automated ?
      Does the file name mean anything ?

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

        Hi,

        The name of the directories/files per se does not mean anything. It just needs to be consistent.

        A part of my application consists of creating Flashcard sets so I have a folder in which I regroup each flashcard set in its own directory. Inside them there is two things : a json file (always named set.json) that contains the informations about the set such as the name of the set given by the user, the text the flashcards contains and path to an image for that flashcard. The second thing is a directory that contains the images. Their name is somewhat meaningful because in the json flashcard1 is associated with flashcard1.png and so on.

        flashcardSet.png
        flashcardSet2.png

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

          Looks like something a small SQLite database could handle rather than filling your hard drive with files.

          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
          • H Offline
            H Offline
            Harsaith
            wrote on last edited by
            #5

            Hi,

            Just to make sure I understand well, you suggest that when the user creates the widget I would store its relevent attributes (name, description, image, etc) in a SQLite database and when the user restarts the application, I would read from the SQLite database to create the widgets, is that correct ?

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

              That's the idea yes.

              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
              1

              • Login

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