The QSqlQueryModel will only fetch data in an unstructured form. So, when you:
Qt Code:
  1. treeView->setModel(sqlQueryModel);
To copy to clipboard, switch view to plain text mode 
You have all the values of the query displayed in an unstructured form.

There are a couple of suggestions on the web, and the easiest one seems to be to create a QStandardItemModel and create a hierarchy from the SQL query. I have a method at the moment (note: it won't compile and there are redundant variables in it at the moment):

Qt Code:
  1. void GUI::createModel(){
  2. model1 = new QStandardItemModel(5, 2); //5 rows, 2 columns
  3. for(int r = 0; r < 5; r ++ ){
  4. QStandardItem* item = new QStandardItem(QString("File%0").arg(r)); //Top level
  5. if(c == 0){
  6. for(int i = 0; i < 3; i ++ ){
  7. QString("Item %0").arg(i));
  8. QString("Item %0").arg(i));
  9. child -> appendRow(child1);
  10. item->appendRow(child);
  11. }
  12. }
  13. model1->setItem(r, c, item);
  14. }
  15. model1->setHorizontalHeaderItem(0, new QStandardItem("Name"));
  16. model1->setHorizontalHeaderItem(1, new QStandardItem("Value"));
  17. }
To copy to clipboard, switch view to plain text mode 

The database (SQLite) holds video data. I want the 'root' to be the file name, and the children to be the names of the tables the values are from.
The result I want is :
|+file1
||+video -Video table
|||--frameRate
|||--codec
||+audio -audio table
|||-bitRate
|||-codec
|+file2
||+video -Video table
|||--frameRate
|||--codec
||+audio -audio table
|||-bitRate
|||-codec

So, I would be grateful if someone could guide me in a painless way of achieving this. I hope I've made myself clear.