Class: Qt::GraphicsScene
Instance Attribute Summary collapse
-
#default_arrow_brush ⇒ Object
readonly
Returns the value of attribute default_arrow_brush.
-
#default_arrow_pen ⇒ Object
readonly
Returns the value of attribute default_arrow_pen.
Instance Method Summary collapse
Instance Attribute Details
#default_arrow_brush ⇒ Object (readonly)
Returns the value of attribute default_arrow_brush.
305 306 307 |
# File 'lib/roby/log/relations.rb', line 305 def default_arrow_brush @default_arrow_brush end |
#default_arrow_pen ⇒ Object (readonly)
Returns the value of attribute default_arrow_pen.
304 305 306 |
# File 'lib/roby/log/relations.rb', line 304 def default_arrow_pen @default_arrow_pen end |
Instance Method Details
#add_arrow(size, pen = nil, brush = nil) ⇒ Object
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/roby/log/relations.rb', line 306 def add_arrow(size, pen = nil, brush = nil) @default_arrow_pen ||= Qt::Pen.new(ARROW_COLOR) @default_arrow_brush ||= Qt::Brush.new(ARROW_COLOR) @arrow_points ||= (1..4).map { Qt::PointF.new(0, 0) } @arrow_points[1].x = -size @arrow_points[1].y = size / 2 @arrow_points[2].x = -size @arrow_points[2].y = -size / 2 polygon = Qt::PolygonF.new(@arrow_points) @arrow_line ||= Qt::LineF.new(-1, 0, 0, 0) ending = add_polygon polygon, (pen || default_arrow_pen), (brush || default_arrow_brush) line = add_line @arrow_line line.parent_item = ending ending.singleton_class.class_eval { attr_accessor :line } ending.line = line ending end |