[Qt-interest] class composition & communication in Qt
pmqt71
pmqt71 at gmail.com
Thu Sep 30 11:16:18 CEST 2010
the signal-slot is a good solution for my needs as it keeps the widget
reusable.
Could you also indicate me a Qt source code where to see this pattern in
use?
thanks a lot
pm
2010/9/30 Frederico A. M. Prado <famprado at terra.com.br>
> If it is not too much information and the MainWindow knows when he widget
> will need the information you could use a signal from the main window
> connected to a slow in the widget.
>
> If the MainWindow does not know when to send to information you can
> request the information in the same way, linking a signal from the widget
> to a slot in mainwindow.
>
> The MainWindow can do both connections when it creates the widget. As far
> as I know that is the usual pattern in QT.
>
> If you have to transfer a lot of information, on the other hand, other
> approaches could be better. You could keep the request as a signal/slot,
> but implement a public function in your widget class which accepts the
> data from when called from the MainWindow, for example.
>
>
>
> On Wed, 29 Sep 2010 11:48:05 -0300, pmqt71 <pmqt71 at gmail.com> wrote:
>
> > Hi all,
> >
> > I have a MainWindow and a widget member class.
> >
> > The widget, while painting, needs information from MainWindow. So what
> > is
> > the best way to access information from the member class to the holding
> > class? Is there an usual pattern in Qt or GOF for this problem?
> >
> > thanks
> > pm
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100930/4872a4a4/attachment.html
More information about the Qt-interest-old
mailing list