code: def selection_range(self):
          
          selected = self.selectionModel().selection()
          """:type: QItemSelection """
  
          if selected.isEmpty():
              return -1, -1
  
          min_row = min(rng.top() for rng in selected)
          max_row = max(rng.bottom() for rng in selected)
  
          return min_row, max_row
docs: :rtype: int, int