model = new QSqlQueryModel(this);model->setQuery("select id,parent,name from table");tree = new QTreeView(this);tree->setModel(model);