code: def saveProfile(self, key, settings=None):
          
          #logger.debug("Writing view settings for: {}".format(key))
          if settings is None:
              settings = QtCore.QSettings()
          settings.setValue(key, self.horizontalHeader().saveState())
docs: Writes the view settings to the persistent store
              :param key: key where the setting will be read from
              :param settings: optional QSettings object which can have a group already opened.