Also, the sort function doesn't do anything.
tableView.setSortingEnabled(true);
tableView.sortByColumn(valueColumn,Qt::DescendingOrder);
tableView.setSortingEnabled(true);
tableView.sortByColumn(valueColumn,Qt::DescendingOrder);
To copy to clipboard, switch view to plain text mode
When I traced it down, it went to
{
Q_UNUSED(column);
Q_UNUSED(order);
// do nothing
}
void QAbstractItemModel::sort(int column, Qt::SortOrder order)
{
Q_UNUSED(column);
Q_UNUSED(order);
// do nothing
}
To copy to clipboard, switch view to plain text mode
I guess that means displaying the data sorted would actually sort the SQL table? I don't want to change the table, I just want to display the data sorted.
Besides that, I'm using QSqlQueryModel because I want the user to be able to type in arbitrary queries. setQuery is protected with QSqlTableModel
Bookmarks