PDA

View Full Version : Qsortfilterproxymodel in a Qthread?



calmspeaker
2nd December 2008, 03:54
If the data in the source model is huge, and the new data is coming continuiously, the sort and filter consume lots of the cpu time and the foregroundcolor of tableview is blinking. In order to make the program more fluently, I am wondering to put qsortfilterproxymodel in another thread. Is that a good idea?

Besides, after I call tableview::sortByColumn(), I want to display data in the orginal order in the source model, how could I do that? I have tried tableview::setSortingEnabled(false),Qsortfilterpro xymodel::setDynamicSortFilter(false), but didn't work.Please give me a hint.:)

jpn
2nd December 2008, 18:40
If the data in the source model is huge, and the new data is coming continuiously, the sort and filter consume lots of the cpu time and the foregroundcolor of tableview is blinking. In order to make the program more fluently, I am wondering to put qsortfilterproxymodel in another thread. Is that a good idea?
Unfortunately not a good idea but rather impossible. You must not touch GUI in worker threads. As long as the model is attached to any view, you cannot alter the model in a worker thread.


Besides, after I call tableview::sortByColumn(), I want to display data in the orginal order in the source model, how could I do that? I have tried tableview::setSortingEnabled(false),Qsortfilterpro xymodel::setDynamicSortFilter(false), but didn't work.Please give me a hint.:)
Remove the proxy model from between the view and the source model?

calmspeaker
4th December 2008, 01:37
Remove the proxy model from between the view and the source model?
I must keep the proxy model to filter the data. Is there another idea?

jpn
4th December 2008, 17:16
I must keep the proxy model to filter the data. Is there another idea?
How about using two proxy models; one for filtering and another for sorting.