Unsolved How to implement def settings_read() and def settings_write() QSettings with QTableView
-
Hi,
How to implement what ?
-
@SGaist yup, sorry, corrected
-
But what do you want to achieve with QSettings and QTableView ?
-
I don't know how to do it. hoping ong QSettings just because don't know another way
-
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 ?
-
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
-
@Lcashe
Let's just be clear about what you want. Forget about the implementation details likeQSettings
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?
-
@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
-
@Lcashe
Then it sounds like you want to persist the model data, and reload it, not whatever happens to be in theQTableView
. You do not need to save e.g. what is in aQLineEdit
. -
Then you might want to consider a simple SQLite database using Qt's SQL module.