MistyD
MistyD

Reputation: 17253

Change order of columns in QTableView

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

Upvotes: 16

Views: 7926

Answers (1)

Chris
Chris

Reputation: 17545

Qt 5.x:

ui->tableView->horizontalHeader()->setSectionsMovable(true);

QHeaderView::setSectionsMovable()

Qt 4.x:

ui->tableView->horizontalHeader()->setMovable(true);

QHeaderView::setMovable()

Upvotes: 24

Related Questions