code: def toggle_view(self, checked):
          
          if not self.dockwidget:
              return
          if checked:
              self.dockwidget.show()
              self.dockwidget.raise_()
          else:
              self.dockwidget.hide()
docs: Toggle view