How can do this:
I already tried this way:
view->header()->setResizeMode(INDEX_COLUMN_SKU, QHeaderView::Interactive);
view->header()->setResizeMode(INDEX_COLUMN_NAME, QHeaderView::Stretch);
view->header()->setResizeMode(INDEX_COLUMN_QUANTITY, QHeaderView::Interactive);
view->header()->setResizeMode(INDEX_COLUMN_PRICE, QHeaderView::Interactive);
but does not work.
Did you remember to view->header()->setStretchLastSection(false)
?
Here are some examples:
treeView->header()->setStretchLastSection(false);
treeView->header()->setStretchLastSection(false); treeView->header()->setResizeMode(1, QHeaderView::Stretch);
From QT5 onwards:
treeView->header()->setStretchLastSection(false); treeView->header()->setSectionResizeMode(1, QHeaderView::Stretch); //! qt5 api change
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With