code: def restore_state(self):
          
          settings = QSettings()
          try:
              last_path = settings.value('directory', type=str)
          except TypeError:
              last_path = ''
          self.output_directory.setText(last_path)
docs: Read last state of GUI from configuration file.
  
          .. versionadded: 3.3