QT 5.5 and QTableView column size adjustment..

  • Hello All!
    How can I make the columns of a table make be "auto ajust" with content... I have try this and doesn't works:


    I have done some code on older versions and this works for me, but now in 5.5 appers to be different. I found some tips that say's to use that: "ui->tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);" but the "setResizeMode" in the new API doesn't exists.

    Thanks for the help!

  • Lifetime Qt Champion


    The new API is setSectionResizeMode

  • Thank you very much!!!!


    Now this uses all space from QTableView.

  • Lifetime Qt Champion

    You're welcome !

    Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

    Also, consider up-voting answer(s) that helped you so the other users may find them more easily.

Log in to reply