Ok es una buena idea, me puedes ayudar a plasmarlo, aca te dejo mi codigo
Código Python:
Ver originaldef load_component(self):
'''
'''
self.model = StandardModel() ---> modelo del arbol
self.model.setRowCount(0)
headers = [self.trUtf8("Grupos"), self.trUtf8("Descripción")]
self.model.setHorizontalHeaderLabels(headers)
self.sort_model = QSortFilterProxyModel()
self.sort_model.setSourceModel(self.model)
self.ui.tree_view.setModel(self.model)
self.ui.tree_view.setSelectionMode(QAbstractItemView.SingleSelection)
self.ui.tree_view.setSelectionBehavior(QAbstractItemView.SelectRows)
self.ui.tree_view.setSortingEnabled(True)
i = 0
while i < 2:
self.ui.table_view.setColumnHidden(i, True)
i += 1
self.ui.tree_view.setModel(self.sort_model)
self.ui.tree_view.setSortingEnabled(True)
self.ui.tree_view.setContextMenuPolicy(Qt.CustomContextMenu)
def prueba(self):
self.modelo = QStandardItemModel() ---> modelo de la tabla
self.modelo.setRowCount(0)
headers1 = ["Grupos", "Nombre")]
self.modelo.setHorizontalHeaderLabels(headers1)
self.sort_model = QSortFilterProxyModel()
self.sort_model.setSourceModel(self.modelo)
self.ui.table_view.setModel(self.sort_model)
self.ui.table_view.resizeColumnsToContents()
self.ui.table_view.setSelectionMode(QAbstractItemView.SingleSelection)
self.ui.table_view.setSelectionBehavior(QAbstractItemView.SelectRows)
self.ui.table_view.setSortingEnabled(True)
self.ui.table_view.setModel(self.sort_model)
self.ui.table_view.setSortingEnabled(True)
self.ui.table_view.setContextMenuPolicy(Qt.CustomContextMenu)