module Vizkit::PortItemUserInteraction
Public Instance Methods
mime_data(items=[])
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 590 def mime_data(items=[]) port_temp = port_from_items items return 0 unless port_temp val = Qt::MimeData.new val.setText URI::Orocos.from_port(port_temp).to_s if defined? URI::DEFAULT_PARSER val end
port_from_items(items = [])
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 539 def port_from_items(items = []) # do not show context menu if clicked on second column return if items.find{|i|i.column == 1} sub_path = items.reverse.map(&:text) #convert string to number if possible sub_path = sub_path.map do |s| if s.to_i.to_s == s s.to_i else s end end if !sub_path.empty? item = items.last port.sub_port(sub_path) else port end end
set_widget_title(widget, name)
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 559 def set_widget_title(widget, name) # It seems that #respond_to? is broken on QtRuby. try the different # methods one by one ... begin widget.window_title = "#{name} #{widget.window_title}" rescue NoMethodError begin widget.setPluginName("#{name} #{widget.getPluginName}") rescue NoMethodError end end end