Kal
23rd September 2008, 03:17
A quick rundown of what I'm trying to accomplish: I have a standardItemModel with two QTreeViews. The first is setup correctly and works fine. The second responds to indirect input. In the main working area, if the user clicks an object, the associations with that object should be visually differentiated. If I click a large blue object and my treeview has 'large' and 'blue' tags in it, I want those strings drawn in different color text.
My problem comes from the convoluted model/view relationship and the lack of helpful Qt docs. I've read everything there is to regarding itemDelegates over and again, and yet I am still completely in the dark about the basics. It seems that only one delegate is set for a given view so perhaps that isn't what I need. How can this be so hard to do cleanly? I have a model that I've queried, I know that items match, and I know my tree reflects this model. Why can't I say "hey tree! draw this 'item' (or your representation thereof) blue"!?
As an aside rant, why do standardItems, the direct members of an objectModel, have any sort of visualization functionality? For instance, when prototyping this thing I queried the tree's model for matches and got a list of standardItems. While I can easily change their foreground color, ALL views with this model reflect the changed color. That is not a separation of model and view at all! In my case, I'm ONLY worried about the view.
My problem comes from the convoluted model/view relationship and the lack of helpful Qt docs. I've read everything there is to regarding itemDelegates over and again, and yet I am still completely in the dark about the basics. It seems that only one delegate is set for a given view so perhaps that isn't what I need. How can this be so hard to do cleanly? I have a model that I've queried, I know that items match, and I know my tree reflects this model. Why can't I say "hey tree! draw this 'item' (or your representation thereof) blue"!?
As an aside rant, why do standardItems, the direct members of an objectModel, have any sort of visualization functionality? For instance, when prototyping this thing I queried the tree's model for matches and got a list of standardItems. While I can easily change their foreground color, ALL views with this model reflect the changed color. That is not a separation of model and view at all! In my case, I'm ONLY worried about the view.