code: def visualRegionForSelection(self, selection):
          
          region = QtGui.QRegion()
          for index in selection.indexes():
              region = region.united(self._rects[index.row()][index.column()])
  
          return region
docs: Gets the region of all of the components in selection
  
          :param selection: a selection model for this view
          :type selection: :qtdoc:`QItemSelectionModel`
          :returns: :qtdoc:`QRegion` -- union of rects of the selected components