class Qt::RubySignalAction
RubySignalAction is the Ruby class which implements the functionality to activate a Ruby Block or Object Method as a result of a Qt emitted Signal
the Ruby method names match the names of the Java interface SignalActions: (see SignalActions.java)
Attributes
block[RW]
method[RW]
receiver[RW]
Public Class Methods
new(receiver=nil,method=nil,&block)
click to toggle source
Calls superclass method
# File lib/qt_connect/qt_jbindings.rb, line 184 def initialize(receiver=nil,method=nil,&block) super() @receiver=receiver @method=method @block=block @args=[] end
Public Instance Methods
append_args(*args)
click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 192 def append_args(*args) @args=args end
emit(a)
click to toggle source
# File lib/qt_connect/qt_jbindings.rb, line 206 def emit(a) args=a+@args n=nil if @method && (md=@method.to_s.match(/([0-9]*)(.+)/x)) #?????????????????? n=md[1].to_i unless md[1]=='' @method=md[2].gsub('()','').to_sym end if (m=args.size)>0 @block.call(*args) if @block if @receiver && @method #cap the number of arguments to number wanted by receiver #e.g. triggered uses signal1 iso signal0 as in example n ||=@receiver.method(@method).arity if (n==0) @receiver.send(@method) else args.slice!(0,n) if (m>n) && (n>0) @receiver.send(@method,*args) end end else @block.call if @block @receiver.send(@method) if @receiver && @method end end