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 implement def settings_read() and def settings_write() QSettings with QTableView
Forum Updated to NodeBB v4.3 + New Features

How to implement def settings_read() and def settings_write() QSettings with QTableView

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 3 Posters 513 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    How to implement what ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    L 1 Reply Last reply
    0
    • SGaistS SGaist

      Hi,

      How to implement what ?

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

      @SGaist yup, sorry, corrected

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

        But what do you want to achieve with QSettings and QTableView ?

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

          I don't know how to do it. hoping ong QSettings just because don't know another way

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

            Let me rephrase that: what is it that you want to do with QSettings in relation with QTableView ? What do you want to store in QSettings ? What do you want to load from it ?

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

              well. maybe can't explain clearly. i have table. i input info with qlineedit in this table. i want when i open the programm next time, the information not to vanish out, other word - to save info

              JonBJ 1 Reply Last reply
              0
              • L Lcashe

                well. maybe can't explain clearly. i have table. i input info with qlineedit in this table. i want when i open the programm next time, the information not to vanish out, other word - to save info

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

                @Lcashe
                Let's just be clear about what you want. Forget about the implementation details like QSettings for a moment.

                Do you persist (save) the model data? When you reload the model, the view will re-show the details of whatever record(s) it is bound to. Normally that is all one does.

                The only point of persisting the values in the view is if you allow the user to type in some stuff, but then not commit it to the model and quit the application. And then when he re-runs the application you wish to pick up what he had typed into the widgets but not saved to the model. Is that what you want to achieve?

                1 Reply Last reply
                1
                • L Offline
                  L Offline
                  Lcashe
                  wrote on last edited by
                  #9

                  @JonB said in How to implement def settings_read() and def settings_write() QSettings with QTableView:

                  The only point of persisting the values in the view is if you allow the user to type in some stuff, but then not commit it to the model and quit the application. And then when he re-runs the application you wish to pick up what he had typed into the widgets but not saved to the model. Is that what you want to achieve?

                  Not exactly. I want to open the programm, write name and points, than see it in the table and save it, and when i start the programm next time, see this information (name, points) again, instead of clear table

                  JonBJ 1 Reply Last reply
                  0
                  • L Lcashe

                    @JonB said in How to implement def settings_read() and def settings_write() QSettings with QTableView:

                    The only point of persisting the values in the view is if you allow the user to type in some stuff, but then not commit it to the model and quit the application. And then when he re-runs the application you wish to pick up what he had typed into the widgets but not saved to the model. Is that what you want to achieve?

                    Not exactly. I want to open the programm, write name and points, than see it in the table and save it, and when i start the programm next time, see this information (name, points) again, instead of clear table

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

                    @Lcashe
                    Then it sounds like you want to persist the model data, and reload it, not whatever happens to be in the QTableView. You do not need to save e.g. what is in a QLineEdit.

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

                      Then you might want to consider a simple SQLite database using Qt's SQL module.

                      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