Hi, I want to rearrange some columns of a QTableView after setting the QTableModel. I want to exchange column 1 with 2. How I can do that?
Thanks
Hi, I want to rearrange some columns of a QTableView after setting the QTableModel. I want to exchange column 1 with 2. How I can do that?
Thanks
have a look at QHeaderView::swapSections.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Marco (5th May 2009)
Thank you!
Qt Code:
headerView->swapSections(2, 1);To copy to clipboard, switch view to plain text mode
Also have a look at QHeaderView::moveSection
QxTableView::QxTableView(QWidget *parent)
: QTableView(parent)
void QxTableView::moveSection(int from, int to)
{
verticalHeader()->moveSection(from, to);
}
void QxTableView::swapSections(int first, int second)
{
verticalHeader()->swapSections(first , second);
}
Bookmarks