Ah, but I believe you’re missing the bigger picture. Files and folders have absolute paths and we can reference them. But of course, coding anything to absolute paths is no good and I believe the same is true for object hierarchies. With files, we develop resolvers and expression to help decouple them from their roots; I believe the same could be true for object hierarchies.
The problem with directly referencing anything is the spaghetti of links you get between objects operating on other objects. The need arose when working with many widgets composited within other widgets (think ItemViews) and where each item needed to signal an event up through a hierarchy. To keep everything perfectly decoupled, it made sense to not introduce a global variable or singleton and have each level instead receive a signal and forward it to its parent until eventually being handled by the topmost parent. Simple in theory. In theory, theory and practice are the same. In practice, they are not. - Albert Einstein What ends up happening is that whenever you introduce another widget in-between two widget, you’ll have to pick up those signals and forward them to the next, and so the story goes. Changing anything was a nightmare. To borrow terminology from Chad, it’s quite the PITA. With qtpath, my thinking is that logical hierarchies can be decoupled from their physical hierarchy, in that widgets with no objectName are skipped during traversal. That way, programmers can design a hierarchy they wish to program against, regardless of any hierarchy Qt enforces upon you (e.g. QScrollArea having multiple unexpected children). # Reference `button`, even though there may be multiple levels of unnamed parents inbetween. $ /root.QWidget/button.QPushButton As for your example, of two object names being identical, this is something I would consider poor programming effort and I’d entrust programmers to not get themselves in such a situation. Thoughts? -- 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/CAFRtmOCWBbt%3DRNz2TMiehsHJCtWoSnF2zU7OCsYGpt3qXdCQDg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
