class Shirka::Qt::TreeController
Public Instance Methods
add_item(text='', controller_class=nil)
click to toggle source
# File lib/shirka/qt/tree/controller.rb, line 21 def add_item(text='', controller_class=nil) controller_class ||= item_controller_class comp = controller_class.new app, self, {text: text, root: self} add_component comp end
init(data)
click to toggle source
# File lib/shirka/qt/tree/controller.rb, line 5 def init(data) @item_ids = {} data.each { |i| add_item i } if data.respond_to? :each end
item_controller_class()
click to toggle source
# File lib/shirka/qt/tree/controller.rb, line 16 def item_controller_class name = self.class.to_s.sub(/Controller$/, 'ItemController') Object.const_get name rescue ::Shirka::Qt::TreeItemController end
on_component_added(component, data=nil)
click to toggle source
# File lib/shirka/qt/tree/controller.rb, line 32 def on_component_added(component, data=nil) id = data @item_ids[id] = component watch component end
on_double_clicked(id)
click to toggle source
# File lib/shirka/qt/tree/controller.rb, line 27 def on_double_clicked(id) controller = @item_ids[id] controller.on_double_clicked end
view_class()
click to toggle source
# File lib/shirka/qt/tree/controller.rb, line 10 def view_class name = self.class.to_s.sub(/Controller$/, 'View') Object.const_get name rescue ::Shirka::Qt::TreeView end