QTableWidget - QHeaderView::ResizeMode - Stretch the columns but still enable user resizing



  • If you set

    header->setResizeMode(QHeaderView::Stretch);

    then the user can't resize the headers. But if you set it to interactive then the columns need a horizontal scroll bar. Is there any way to get the stretch by default and still resize?

    The winforms datagridview style behavior is what I am going for.



  • You could use "strechLastSection":http://doc.qt.nokia.com/4.7/qheaderview.html#stretchLastSection-prop which stretch only the last one and use a resizeToContents after filling in the data.
    Then the user could change the width but the last column always fits.


Log in to reply
 

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