class Vizkit::WidgetTaskConnector
Attributes
task[R]
widget[R]
Public Class Methods
new(widget,task,options = Hash.new)
click to toggle source
# File lib/vizkit/widget_task_connector.rb, line 6 def initialize(widget,task,options = Hash.new) raise ArgumentError,"#{widget} is not a qt object" unless widget.is_a? Qt::Object @widget = widget @task = task @options = options end
Public Instance Methods
EVENT(str)
click to toggle source
# File lib/vizkit/widget_task_connector.rb, line 47 def EVENT(str) "7#{str}" end
METHOD(str)
click to toggle source
# File lib/vizkit/widget_task_connector.rb, line 55 def METHOD(str) "9#{str}" end
OPERATION(str)
click to toggle source
# File lib/vizkit/widget_task_connector.rb, line 43 def OPERATION(str) "6#{str}" end
PORT(str)
click to toggle source
# File lib/vizkit/widget_task_connector.rb, line 39 def PORT(str) "5#{str}" end
PROPERTY(str)
click to toggle source
# File lib/vizkit/widget_task_connector.rb, line 51 def PROPERTY(str) "8#{str}" end
connect(sender,receiver=nil,options= Hash.new,&block)
click to toggle source
# File lib/vizkit/widget_task_connector.rb, line 18 def connect(sender,receiver=nil,options= Hash.new,&block) source = resolve(sender) receiver,options= if receiver.is_a? Hash [nil,receiver] else [receiver,options] end if receiver && block raise ArgumentError "Code blocks act as receivers and are not supported if a reveiver is already given." end receiver = resolve(receiver || block) options[:getter] = resolve(options[:getter]) if options[:getter] options[:callback] = resolve(options[:callback]) if options[:callback] source.connect_to receiver,options end
evaluate(&block)
click to toggle source
# File lib/vizkit/widget_task_connector.rb, line 13 def evaluate(&block) @self_before_instance_eval = eval "self", block.binding instance_exec @task, &block end
method_missing(method, *args, &block)
click to toggle source
# File lib/vizkit/widget_task_connector.rb, line 35 def method_missing(method, *args, &block) @self_before_instance_eval.send method, *args, &block end
wrap(widget)
click to toggle source
Wrapper method to connect sub widgets which are plain Qt ruby classes
# File lib/vizkit/widget_task_connector.rb, line 60 def wrap(widget) WidgetTaskConnector.new(widget,@task,@options) end