I wanted to know how we can change the order of columns in QtableView by dragging ? I currently have a class derived from FilterProxyModel as source to QtableView. I am using QT 4.8
To change the column order In Object Explorer, right-click the table with columns you want to reorder and select Design. Select the box to the left of the column name that you want to reorder. Drag the column to another location within the table.
Qt 5.x:
ui->tableView->horizontalHeader()->setSectionsMovable(true);
QHeaderView::setSectionsMovable()
Qt 4.x:
ui->tableView->horizontalHeader()->setMovable(true);
QHeaderView::setMovable()
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