View Full Version : 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.
Santosh Reddy
3rd May 2013, 11:19
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
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.
Santosh Reddy
3rd May 2013, 15:40
model=sourceModel() <-- this is not working
What dou mean not working? are you sure the source model is set before that?
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.
Santosh Reddy
3rd May 2013, 16:11
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.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.