[Qt-interest] adressing something to the mainWindow from a dialog

Andrea Franceschini therealmorpheu5 at gmail.com
Tue Apr 7 16:16:32 CEST 2009


Now that I've been staring at the whole discussion for like five
minutes, and since I'm
 going to graduate in CS and will probably apply for a PhD course ;)
 I'd like to understand one little thing (which of course best fits
 into the "C++ best practices" than "Qt" category, so feel free to
 ignore my question): isn't it in the first place somehow wrong to give
 a "conceptually child" class permission to access its parent? If this
 is true, I'd better go the way I first suggested, i.e. to define
 appropriate pointers inside the dialog and make the parent class make
 them point to its appropriate variables so that the child has "limited
 knowledge" of its surrounding environment.

 Under this light, the whole parent()/global qApp ideas look like dirty
 workarounds, am I wrong? I usually try to avoid child->parent access
 when it's possible, although I agree it's mostly useful, instead going
 for parent->child which sounds to me much better in terms of elegance.



More information about the Qt-interest-old mailing list