PDA

View Full Version : Models in cascade



thrantir
17th January 2007, 12:27
This is my first post, so hi to everyone!

I'm italian, then i first ask to forgive me for my very bad english!

Now, my problem:

I'm using Qt model/view paradigm and yesterday I found an error I cannot understand. I have two tree view and a tree model. I use a QSortFilterProxy to re-define the sort criteria for my rows. This criteria are the same for each view. In addiction, I must filter some rows for one of the two views.

So, I've got this:

- create a standard tree view
- create a derived model to store my data -> the Model
- create a derived sort filter proxy to show my data sorted as i want -> the SortProxy
- create a derived sort filter proxy to filter some rows for one of my two views -> the FilterProxy

then, i set my model as source model for my SortProxy, and my SortProxy as source model for my FilterProxy.

Then, i start my program and populate my model. In the view associated with the FilterProxy, i'm catching a contest menu' request, to show a context menu' with some actions. When I click the right button of my mouse on a child node of this view, the application crash. The call stack shows that the problem was generating from a layoutChanged signal from the Model, I've something like this:

-->MyModel::layoutChanged
-->MyFilterProxy::reset
-->MyFilterProxy::clear
(...fails in "proxy_to_source"...)

After two hours of panic, I discovered that the problem derived form proxies in cascade: if a use two different sort filter proxy, one for each view, the problem disappear

Then, someone knows why I can't use proxies in cascade?

Thanks in advance :)

e8johan
17th January 2007, 12:50
I suggest that you report this to Trolltech's task tracker as it seems to be a rather subtle bug. You can find the task tracker here: http://www.trolltech.com/developer/task-tracker .

BTW, your English is just fine :-)

thrantir
17th January 2007, 13:44
I suggest that you report this to Trolltech's task tracker as it seems to be a rather subtle bug. You can find the task tracker here: http://www.trolltech.com/developer/task-tracker .

Ok, I'll do it as soon as I can



BTW, your English is just fine :-)

Thanks, I hope I'm improving my english writing in forum like this, it's a good exercise, for both my language and my programming skills :)

wysota
17th January 2007, 17:41
Is the model a standard model or a custom one?

thrantir
18th January 2007, 09:08
Yes it is: I created my derived model following the example provided with Qt documentation.

Are you thinking i forgot something when I derived that model?

wysota
18th January 2007, 10:38
Yes it is: I created my derived model following the example provided with Qt documentation.

Are you thinking i forgot something when I derived that model?

Yes, I think you messed up something with indexes. Could you please post a detailed back trace (call stack)?

thrantir
18th January 2007, 15:05
i've changed mi program to not use proxies in cascade... if i have the time, i'll re-do what i did and post you the backtrace when the error occurs