[Qt-interest] adressing something to the mainWindow from adialog
Scott Aron Bloom
Scott.Bloom at sabgroup.com
Tue Apr 7 16:24:33 CEST 2009
You are ABSOLUTELY correct...
A child, except in some limited cased (like tree widget items) should
basically have no knowledge of its parents...
Do so, limits the childs usefulness, since it can only be used for that
parent..
Scott
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Andrea Franceschini
> Sent: Tuesday, April 07, 2009 7:17 AM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] adressing something to the mainWindow from
adialog
>
> 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.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list