Hi,

I use Qt v4.0.1 (OpenSource) on the Win XP.
My app query some rows from the mysql server and show it into the QTableView.
What I want is to sort the QTableView when the header column is clicked.
I tried to use this slot but it didn't work :

void QTableView::sortByColumn ( int column ) [slot]
( Sorts the model by the values in the given column.)

Can anybody help me or give me some suggestions, please?
Thanks,
Gabriel S

These are parts of my code :
.............

QTableView *tableView = new QTableView(WindMaincall);
QSqlQueryModel *model = new QSqlQueryModel(tableView);

connect(tableView->horizontalHeader(),SIGNAL(sectionClicked(int)), tableView, SLOT(sortByColumn(int)));
...................
model->setQuery( "SELECT field1,field2 FROM table1" );
tableView->setModel(model);