Instead of creating dozens of widgets, you might consider using one QTreeView and several models.