Find unique elements for a given column in a table model



  • I need to find each unique combination in a table

    Suppose I have a table that looks like this

    Column1 Column2 Column3
    A C F
    A C F
    A D F
    B C F
    B C G
    B D F
    B D G
    B E F

    (1) I need to understand that Column1 is composed by two different elements A and B
    (2) Then for each element found in column1 I need to filter the table - the result will be two tables

     Column1  Column2  Column3
       A       C       F
       A       C       F
       A       D       F
     
     Column1  Column2  Column3
       B       C       F
       B       C       G
       B       D       F
       B       D       G 
       B       E       F
     
    Then for each table do the same with Column2
    
    Column1  Column2  Column3
       A       C       F
       A       C       F
       
    Column1  Column2  Column3   
       A       D       F
    
      ... and so one with each Column on the table
    

    I suppose thar the filtering of the table can easily be done via QSortFilterProxyModel

    However I am not sure what to use to perform operation (1) i.e. to understand for a given column how many different elements the cloumn is composed by..... Maybe someone will have a clever idea to solve this.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.