QSortFilterProxyModel and accissing data
First I program in PyQt but can read code in Qt
I have a proxymodel derived QSortFilterProxyModel
I this class I reimplement filterAccepsRow()
Here I can access my data with model=sourceModel()
My question:
How can I access my data outside this filterAccepsRows() because in the class body sourceModel() is not working
Any hints are welcome.
Thanks in advance.
Re: QSortFilterProxyModel and accissing data
Quote:
How can I access my data outside this filterAccepsRows() because in the class body sourceModel() is not working
Why do you need to access the filter data outside the class?
sourceModel() will return a model only when a source model is on the proxy model
Re: QSortFilterProxyModel and accissing data
Not outside the class.
Inside the class but not in filterAccepsRow()
I have the following pseudo code
class sortfilterproxymodel
def populate_combobox():
access data needed to populate combobox
model=sourceModel() <-- this is not working
def filteracceptsrow()
model=sourceModel() <-- this is working
do stuff <-- OK
I assume I'm doing something wrong so a hint will be appreciated.
Re: QSortFilterProxyModel and accissing data
Quote:
model=sourceModel() <-- this is not working
What dou mean not working? are you sure the source model is set before that?
Re: QSortFilterProxyModel and accissing data
I'm sure because everything is working, my delegate, my tableview, my model even filtering is working as I expect.
The only exception is that I cannot populate the combobox with the data because I cannot access the data in the main body of sortfilterproxymodel class.
Re: QSortFilterProxyModel and accissing data
Do you want to access filterted data, or the un-filtered data?
In most cases sourceModel is not required to be used, unless custom filterring is being employed?
I think it's time to see what you are doing to populate the combo box? Show us the code to populate the combo box.