Class: MouseTimer

Inherits:
Qt::Object show all
Defined in:
ext/ruby/qtruby/examples/graphicsview/collidingmice/mouse.rb

Overview

In the original C++ example the Mouse class inherited from both QObject and QGraphicsItem. As that isn’t possible in Ruby, use a helper class ‘MouseTimer’ to periodically invoke the Mouse.timerEvent() method.

Instance Method Summary collapse

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(mouse) ⇒ MouseTimer

Returns a new instance of MouseTimer.



32
33
34
35
# File 'ext/ruby/qtruby/examples/graphicsview/collidingmice/mouse.rb', line 32

def initialize(mouse)
    super(nil)
    @mouse = mouse
end

Instance Method Details

#timerEvent(event) ⇒ Object



37
38
39
# File 'ext/ruby/qtruby/examples/graphicsview/collidingmice/mouse.rb', line 37

def timerEvent(event)
    @mouse.timerEvent(event)
end