code: def _remove_layer_clicked(self):
          
          layer = self.list_layers_in_map_report.selectedItems()[0]
          origin = layer.data(LAYER_ORIGIN_ROLE)
          if origin == FROM_ANALYSIS['key']:
              key = layer.data(LAYER_PURPOSE_KEY_OR_ID_ROLE)
              parent = layer.data(LAYER_PARENT_ANALYSIS_ROLE)
              parent_item = self.tree.findItems(
                  parent, Qt.MatchContains | Qt.MatchRecursive, 0)[0]
              item = QTreeWidgetItem(parent_item, [definition(key)['name']])
              item.setData(0, LAYER_PARENT_ANALYSIS_ROLE, parent)
          else:
              parent_item = self.tree.findItems(
                  FROM_CANVAS['name'],
                  Qt.MatchContains | Qt.MatchRecursive, 0)[0]
              item = QTreeWidgetItem(parent_item, [layer.text()])
              layer_id = layer.data(LAYER_PURPOSE_KEY_OR_ID_ROLE)
              item.setData(0, LAYER_PURPOSE_KEY_OR_ID_ROLE, layer_id)
          item.setData(0, LAYER_ORIGIN_ROLE, origin)
          index = self.list_layers_in_map_report.indexFromItem(layer)
          self.list_layers_in_map_report.takeItem(index.row())
          self.list_layers_in_map_report.clearSelection()
docs: Remove layer clicked.