Thanks Justin. The code example above is using custom events, and I think it should do what I'm looking for, but I won't know for sure until tomorrow once i've integrated it.
As for event filters, don't have much experience with those, but do you think they would allow for the same thing? Without or with custom events? And finally, multiple views is fancy but are not important in this situation. If that was a requirement, I would definitely go for separating the model. Ultimately, I believe that my requirements are low, that there is a straightforward solution, and that throwing pre-packaged widgets or QAbstractItem* at the problem is only escalating things. Looking forward to your thoughts on the example, I find it nimble and complete, more sophisticated than what I've got going on currently and mainly simple and easy to communicate to others with minimal knowledge of Python. Best, Marcus On Thursday, June 5, 2014, Justin Israel <[email protected]> wrote: > I wouldn't call it a magic bullet either. They are more complicated to set > up for sure. But they do work well in situations where you have multiple > views on the same data. I've done the Miller Column thing both using the > built in QColumnView, and also setups that use the vertical layout with > custom widgets, like you are doing. The QColumnView is pretty much a bunch > of list views in a horizontal scroll that have their root item set to > different levels of the same model. So multiple views share the same data. > In the case of the custom widgets in vertical layouts, when I have done > stuff like that, I have usually given the "run" button equivalent the > context it needs to use when the click happens. Like giving it a prewrapped > callback that it does not have to know about. But you obviously know at the > time of its creation that it has a context. > > But ya lets just leave the whole model thing aside because it is a drastic > mental shift than what you are already doing. Always something that can be > played with later. I can try and take a more focused look at your code > example tonight, but it does seem like something could be done with an > event filter or customEvents. Ultimately as long as you get some sort of > mechanism that pushes events up the chain, you would be good. I wasn't > clear on the part where you said you didn't want to overload the event() > method since you weren't sure of its logic. But I would think you could > still do that and perform save operations, and then call the original event > handler at the end. > > > > > > > On Fri, Jun 6, 2014 at 7:51 AM, Marcus Ottosson <[email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote: > >> Well, the general issue I see with the QAbstractItem* family is its >> complexity and that it seems better suited for massive datasets, for which >> I suspect it was designed. >> >> I believe it can be simpler if datasets aren't as large. (less than >> hundreds of items) >> >> If you have a look at the example I just posted, can you see where such a >> model would fail and where a QAbstractItem* approach would make it easier >> to maintain? Even if we disregard the low count in items, and disregard >> performance, can you see anywhere where this model would stop making sense? >> >> I'm trying hard to KISS, QAbstractItem* isn't simple enough. I really >> don't think it's as much of a silver bullet as it you're making it out to >> be. >> >> >> On 5 June 2014 20:44, Justin Israel <[email protected]> wrote: >> >> Yea sorry. Apparently I don't get it either. I was following Tony's reply >> and it made sense to me but I suppose was not applicable to you? I also saw >> it as a situation where child items in a model know their own context and >> their parent item. So when representing the "run" item, it knows the >> context of it being a "run command for snake within the stats location" >> because it all shares the same underlying data to know that. The fact that >> it is a button with a signal is part of the view/delegate aspect. A custom >> data role could give you back the "context" object that you need for the >> view or delegate to perform the action in response to the click. >> Again, like Tony, I apologize if this sounds complicated or abstract. It >> still doesn't click for me that it needs to be a massive signal passing >> situation. Only so if you are purely working with widgets that are nested >> and don't know about each others logic as opposed to a model that already >> knows all the data in one place. >> The performance and data aspects of the model aren't just about what is >> currently visible. It is also about all the data that is know but not >> visible. Like if you are modeling a filesystem, you may not be in a >> location viewing a ton of files and directories, but that doesn't mean the >> model couldn't resolve sibling or child directory listing ahead of time and >> have extra data available. Or that you could resolve info about parent >> locations that may not be displaying the data in a view, but have the data >> available in the model (like the listing of a directory for which you had >> just browsed through while navigating down). >> I can see why in this situation you would need to pass a lot of dynamic >> signals, when widgets are completely autonomous. If you are sticking with >> that approach then it might be good to keep trying that customEvent >> propagation technique that people list online, and seeing if you can get >> it to work. Your custom widgets would probably have to have a customEvent >> method implemented to handle the event if they want. The manual propagation >> method you found gets around that need by continuing to drive it up the >> chain until someone handles it. I'm not sure off hand but maybe the >> customEvent default implementation accepts the event. >> On Jun 6, 2014 3:40 AM, "Marcus Ottosson" <[email protected]> >> wrote: >> >> I'm making an appearance here too. >> >> http://stackoverflow.com/questions/24064422/traverse-events-through-hierarchy-of-unique-widgets >> >> >> On 5 June 2014 16:38, Marcus Ottosson <[email protected]> wrote: >> >> Aw. :'( Ok, thanks again for sticking with me this long! >> >> >> >> >> -- >> *Marcus Ottosson* >> [email protected] >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programmi >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCLF5dCi%3DPmE1ZKGOttM5dn3HqHCX0PXww5HHRdoFMBXg%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCLF5dCi%3DPmE1ZKGOttM5dn3HqHCX0PXww5HHRdoFMBXg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <javascript:_e(%7B%7D,'cvml','python_inside_maya%[email protected]');> > . > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3gR-mwQBc7Q1L25GAcajvoJ2VeRA6oQAXkiP8ZrNABmA%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3gR-mwQBc7Q1L25GAcajvoJ2VeRA6oQAXkiP8ZrNABmA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- *Marcus Ottosson* [email protected] -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBAYw%2BLNYEqUsoFEtttMyEKctNoCsPXv9Vbyyp-wrbaiA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
