Module: Ui::RelationsView::GraphicsViewBehaviour
- Defined in:
- lib/roby/gui/relations_view.rb
Overview
Module used to extend the relation view GraphicsView object, to add double-click and context-menu events
Instance Attribute Summary collapse
-
#display ⇒ Object
Returns the value of attribute display.
Instance Method Summary collapse
Instance Attribute Details
#display ⇒ Object
Returns the value of attribute display.
86 87 88 |
# File 'lib/roby/gui/relations_view.rb', line 86 def display @display end |
Instance Method Details
#contextMenuEvent(event) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/roby/gui/relations_view.rb', line 103 def contextMenuEvent(event) item = itemAt(event.pos) return super(event) if item && !(obj = display.object_of(item)) return unless obj.kind_of?(Roby::Task) = Qt::Menu.new hide_this = .add_action("Hide") hide_children = .add_action("Hide children") show_children = .add_action("Show children") return unless action = .exec(event.globalPos) case action.text when "Hide" display.selected_objects.delete(obj) when "Hide children" obj.plan.compute_useful_tasks([obj]).each do |child| if child != obj display.selected_objects.delete(child) end end when "Show children" obj.plan.compute_useful_tasks([obj]).each do |child| if child != obj display.selected_objects << child end end end display.update end |
#mouseDoubleClickEvent(event) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/roby/gui/relations_view.rb', line 88 def mouseDoubleClickEvent(event) item = itemAt(event.pos) if item obj = display.object_of(item) || display.relation_of(item) return super(event) unless obj end @object_info ||= Roby::GUI::ObjectInfoView.new if @object_info.display(obj, display.plans[0]) @object_info.activate end end |