[Kde-bindings] Qyoto: SIGNALS/SLOTS

Richard Dale Richard_Dale at tipitina.demon.co.uk
Tue Dec 13 17:53:39 UTC 2005


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?

-- Richard



More information about the Kde-bindings mailing list