Dear,
This is it.
app = Qt::Application.new(ARGV)
app.installEventFilter(Yak::KeyDispatcher.new)
...
module Yak
class KeyDispatcher < Qt::Object
def initialize
super
end
def eventFilter(object, event)
if event.type() == Qt::Event::KeyPress # Here, if I
puts(event.type()), it does output integers which are the
values of
event consts. But in '==' operation, it warns and never
equals.
# deal with all key input.
return true
else
return super(object, event)
end
end
protected(:eventFilter)
end
end
Richard Dale wrote:
> On Tuesday 30 October 2007 09:23:00 Magicloud
Magiclouds wrote:
>> Dear,
>> My qtruby is 1.4.9, ruby is 1.8.6.111.
>> I also tried "if event.type() ==
Qt::Event::KeyPress", same warning....
> Thanks, but what sort of event is it?
>
>> Richard Dale wrote:
>>> On Tuesday 30 October 2007 06:20:58 Magicloud
Magiclouds wrote:
>>>> Dear all,
>>>> Something like "if event.type ==
Qt::Event::KeyPress" only gives
>>>> "warning: Object#type is deprecated;
use Object#class", and does not
>>>> work as expected.
>>>> How to resolve this?
>>> That should work, but the type() method needs
to be special cased for
>>> each Qt::Event class. Which version of QtRuby
and which Qt::Event class
>>> is it?
>>>
>>> -- Richard
>>>
_______________________________________________
>>> Kde-bindings mailing list
>>> Kde-bindings kde.org
>>> ht
tps://mail.kde.org/mailman/listinfo/kde-bindings
>> _______________________________________________
>> Kde-bindings mailing list
>> Kde-bindings kde.org
>> ht
tps://mail.kde.org/mailman/listinfo/kde-bindings
>
>
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings kde.org
> ht
tps://mail.kde.org/mailman/listinfo/kde-bindings
>
_______________________________________________
Kde-bindings mailing list
Kde-bindings kde.org
ht
tps://mail.kde.org/mailman/listinfo/kde-bindings
|