View Full Version : Delegate question...

6th June 2009, 04:33

I have an app that uses QTreeView and MyModel ( a subclass from QAbstractItemModel)

I have 4 columns in my modelItem and I want to let the 4th column to show true when the value of col 2 and 3 are the same and FALSE otherwise.

My plan is to populate my model with col 1 to 3 then In my view i would use a delegate on col 4 that will look at cols 2 and 3 and decide if its true or false.

Is this doable? any other advise from the experts.


My tree view

Item Data1 Data2 Result
|- a 1 1 TRUE //<-- delegate
| |-a1 1 2 FALSE
|-b 2 2 FALSE


6th June 2009, 06:48
Is this doable?
Yes it is :)

But it will be better if you keep that logic in the model itself... delegates shouldnt be used for deciding what to display, rather HOW to display