Re: Multiple parents; not inheritance

Originally Posted by
tescrin
I'm looking to use what I consider an "elegant" solution of having the same child have multiple parents; The reason being the only things these dialogs share are a few buttons; but I figured if I could figure out how to give the same thing multiple parents then it reduces the duplicate work. The only times these buttons have unique operations called on them (outside of their menus and things) are from their parents calling "hide" and such (implicitly.)
I'm assuming you can't do this since you pass in a parent pointer at the beginning, and merely having the child object's pointer in the class is probably not enough (since Qt won't consider it an official parent; as we haven't passed in the second parent's pointer.)
Thoughts?
Qt has very exact rules for what happens when something has a parent. The framework rules will only allow for one parent.
Making two instances of the same class and giving them to different parents IS NOT duplicate work, so I don't know what you are getting at.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
Bookmarks