[Kde-bindings] Qyoto: SIGNALS/SLOTS

Arno Rehn arno at arnorehn.de
Tue Dec 13 18:23:26 UTC 2005


Am Dienstag, 13. Dezember 2005 18:53 schrieb Richard Dale:
> On Monday 12 December 2005 20:05, Arno Rehn wrote:
> > Am Montag, 12. Dezember 2005 18:01 schrieb Richard Dale:
> > > 		// Which reflection method can be used to get the parent interface
> > > 		// of IQApplicationSignals, so it doesn't need to be hard coded
> > > 		// as IQObjectSignals like here?
> > > 		miSignal = typeof(IQObjectSignals).GetMethod("Destroyed");
> > > 		attributes = miSignal.GetCustomAttributes(typeof(Q_SIGNAL), false);
> > > 		if (attributes.Length > 0) {
> > > 			Q_SIGNAL signalAttr = (Q_SIGNAL) attributes[0];
> > > 			Console.WriteLine( "Q_SIGNAL signature: {0}", signalAttr.Signature
> > > ); }
> >
> > Try this:
> >
> >  		miSignal =
> > typeof(IQApplicationSignals).BaseType.GetMethod("Destroyed");	//with
> > 'BaseType' you get the first type that the current type is derived from
> >  		attributes = miSignal.GetCustomAttributes(typeof(Q_SIGNAL), false);
> >  		if (attributes.Length > 0) {
> >  			Q_SIGNAL signalAttr = (Q_SIGNAL) attributes[0];
> >  			Console.WriteLine( "Q_SIGNAL signature: {0}", signalAttr.Signature );
> >  		}
>
> I've just been trying this and I get a null returned by
> typeof(IQApplicationSignals).BaseType. Is that because interfaces can have
> more than one BaseType? Is there a BaseTypes attribute for interfaces that
> returns an Array of types?

Or try 'typeof(IQApplicationSignals).GetInterfaces()'. this should work 
really.

-- 
MfG
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list