How to display QAbstractListModel in Qtreeview?

36 views Asked by At

I am using QPdfsearchmodel along with QIdentityProxyModel to search a pdf and return a tuple with the info I am looking for. How do I load each of the four items into a 4 column QTableview and not a single column QListView?

Here's my class for the proxy model:

class MyProxy(QIdentityProxyModel):
    def __init__(self, parent=None):
        super().__init__(parent)

    
    def data(self,index, role):
        
        if role == Qt.ItemDataRole.DisplayRole:
            return f"('{super().data(index, role)}','{super().data(index,256)}','{super().data(index,257)}','{super().data(index,258)}')"


        return super().data(index,role)

How do I load into a 4 column Qtableview with each column having one item of data instead of single column QListview?

0

There are 0 answers