Am 12.06.2012 um 21:36 schrieb Jochen Becher <jochen_bec...@gmx.de>:

> In my case childB is not a child of childA but both are children of
> parent (widgets in the same group/layout). But childB has a reference to
> childA which might be accessed in destructor.

Smells like bad gasoline: usually widgets ("Views") should not know about each 
other! They should operate on a common "Model" which informs their "views" 
anonymously ("Qt signals" *strong hint*) that something happened.

Alternatively have a "Controller" (practically the "top-level" dialog 
containing all the child widgets, but can really be a separate non-GUI class) 
which takes care of updating any sibling widget(s) when a given child widget 
has changed (again "signals" *hint* *hint*).

Like this you *decouple* all your different widgets (views), and they can be 
deleted by their parent widget without worries - in /any/ order.

The "Model" itself is deleted "in a controlled manner" (exactly once) - by, uh, 
the "Controller".


And yes, all this goes under MVC pattern (very basic stuff ;)).

Cheers,
  Oliver
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to