2

I am looking to save all of the info and restore on button click for my application using QSettings. I used code from How to save selected Items to Qsettings from QListWidget, QTableWidget

The code from the accepted answer is edited to work for QLineEdit/QComboBox/QRadioButton/QCheckBox/QListView/QTableView

My application is being saved on exit, and restored when clicking main windows toolbar button.

My issue is that code works perfectly if the tabs are static, however when adding dynamic tabs it creates the following issues;

  1. On startup it has only one main tab, so it needs to create the number of tabs as it had when it saved the settings - possibly just get the count of tabs and in the restore method, programatically add number of tabs

  2. If you add the same number of tabs as it had when you exited, it copies the widgets info from the active tab when it was exited

My issue with #1 is that I do not know how I can call my addNewTab() method to programatically add the tab after I get the tab count from QSetting file.

My general question is, how can I implement the desired QSettings code to work for dynamically created tabs?

Working Example:

https://github.com/David52920/QSettings.git

Test_MDI.py is the main file

S. Nick
  • 12,879
  • 8
  • 25
  • 33
dree
  • 170
  • 1
  • 11

0 Answers0