Hello all,

Lets suppose I have a database table called people filled with names and addresses. I fill a qTreeWidget by doing

Qt Code:
  1. QTreeWidgetItem* peopleNode;
  2. treeWidget->addTopLevelItem( peopleNode );
  3.  
  4. query.exec( "SELECT first_name FROM people;" );
  5. while( query.next() ) {
  6. QTreeWidgetItem* PeopleList = new QTreeWidgetItem(peopleNode);
  7. PeopleList->setText( 0, query.value(0).toString() );
  8. }
To copy to clipboard, switch view to plain text mode 

I would like to be able to right click on the peopleNode or items within and have a "sort by" menu which would list all the table columns and then sort the Node by that column.

Can anyone see a way of doing this