def get_idx_rect(index_list):
 (rows, cols) = list(zip(*[(i.row(), i.column()) for i in index_list]))
 return (min(rows), max(rows), min(cols), max(cols))

def get_idx_rect ( index_list ) : ( rows , cols ) = list ( zip ( * [ ( i . row ( ) , i . column ( ) ) for i in index_list ] ) ) return ( min ( rows ) , max ( rows ) , min ( cols ) , max ( cols ) )
extract the boundaries from a list of indexes .