code: def readViewSettings(self, key, settings=None):
          
          #logger.debug("Reading view settings for: {}".format(key))
          if settings is None:
              settings = QtCore.QSettings()
  
          horizontal_header = self.horizontalHeader()
          header_restored = horizontal_header.restoreState(settings.value(key))
  
          # update actions
          for col, action in enumerate(horizontal_header.actions()):
              is_checked = not horizontal_header.isSectionHidden(col)
              action.setChecked(is_checked)
  
          return header_restored
docs: Reads the persistent program settings
  
              :param key: key where the setting will be read from
              :param settings: optional QSettings object which can have a group already opened.
              :returns: True if the header state was restored, otherwise returns False