OK, I solved this problem using QTreeView and treemodel. Thanks.