After populating the QTreeView, I am using the following commands to sort the tree.

However, nothing changes in QTreeView.

Can anybody tell me what might be the issue?

Qt Code:
  1. ui->treeView->setSortingEnabled(true);
  2. ui->treeView->sortByColumn(0, Qt::DescendingOrder);
To copy to clipboard, switch view to plain text mode