[Solved] Setting size of QTableView Header

  • Hi,
    I have created a QTableView with QStandardItemModel. I have set the header as follows:
    QString headerlist ;
    headerlist << c1 << c12<< c123;

    I want to set my header size on the basis of size of string in headerlist. E.g. here size of col1 is 2 , col2 is 3 ...and so on....
    Please suggest a way to do it. I see resizeSection() as one of the solutions. Is there any other way ?


  • Try:


    If the data get out of display area, it will add scrolls. If you also want the table to adjust to display all the columns, you need to do a bit more.

  • Hey Thanks,
    I think this is good for me.

Log in to reply

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