Re: explicit signal connection vs. overriding function



And what are the advantages of each way of connecting signals?

It seems to me that overriding a signal method requires less typing, and results perhaps in more readable code.

On the other hand, the method on_expose_event used in DrawingArea is protected, so one can override it only if one derives from DrawingArea, which may not be always expedient.

Are there any other advantages and disadvantages?

And are there any subtle semantic differences between the two ways? I would assume that overriding the signal method somehow causes the signal to be connected behind the scenes, though I have no clue how that would be done.





----- Original Message ----
From: José Alburquerque <jaalburquerque cox net>
To: Piscium <groknok yahoo ie>
Cc: gtkmm-list gnome org
Sent: Mon, 10 May, 2010 21:30:55
Subject: Re: explicit signal connection vs. overriding function

On Mon, 2010-05-10 at 19:57 +0000, Piscium wrote: 
> This begs the question: are the two methods of handling signals equivalent? Is it always possible to choose either of them?
> 

Yes, there are two methods.  Classes that are derived from Glib::Object
that have signals such as signal_signalname() (which can be connected
to) also have virtual methods such as on_signalname().  If that class is
overridden, overriding the on_signalname() is another way of handling
the signal.

-- 
José





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]