Class: RobotLimb

Inherits:
RobotPart show all
Defined in:
ext/ruby/qtruby/examples/graphicsview/dragdroprobot/robot.rb

Instance Method Summary collapse

Methods inherited from RobotPart

#dragEnterEvent, #dragLeaveEvent, #dropEvent

Methods inherited from Qt::GraphicsItem

#type

Methods inherited from Qt::Base

#%, #&, #*, #**, #+, #-, #-@, #/, #<, #<<, #<=, #==, #>, #>=, #>>, #QCOMPARE, #QEXPECT_FAIL, #QFAIL, #QSKIP, #QTEST, #QVERIFY, #QVERIFY2, #QWARN, #^, ancestors, #is_a?, #methods, private_slots, #protected_methods, #public_methods, q_classinfo, q_signal, q_slot, signals, #singleton_methods, slots, #|, #~

Constructor Details

#initialize(parent) ⇒ RobotLimb

Returns a new instance of RobotLimb.



120
121
122
# File 'ext/ruby/qtruby/examples/graphicsview/dragdroprobot/robot.rb', line 120

def initialize(parent)
    super(parent)
end

Instance Method Details

#boundingRectObject



124
125
126
# File 'ext/ruby/qtruby/examples/graphicsview/dragdroprobot/robot.rb', line 124

def boundingRect
    return Qt::RectF.new(-5, -5, 40, 10)
end

#paint(painter, option, widget) ⇒ Object



128
129
130
131
132
# File 'ext/ruby/qtruby/examples/graphicsview/dragdroprobot/robot.rb', line 128

def paint(painter, option, widget)
    painter.brush = Qt::Brush.new(@dragOver ? @color.light(130) : @color)
    painter.drawRoundRect(boundingRect(), 50, 50)
    painter.drawEllipse(-5, -5, 10, 10)
end