code: def saveProfile(self):
          
          if not self.profile:
              logger.warning("No profile defined (no settings saved)")
              return
  
          settings = QtCore.QSettings()
          logger.debug("Writing settings to: {}".format(settings.fileName()))
  
          profGroupName = self.profileGroupName()
          settings.remove(profGroupName) # start with a clean slate
  
          assert self.mainWindows, "no main windows found"
          for winNr, mainWindow in enumerate(self.mainWindows):
              settings.beginGroup(self.windowGroupName(winNr))
              try:
                  mainWindow.saveProfile(settings)
              finally:
                  settings.endGroup()
docs: Writes the current profile settings to the persistent store