[Kde-bindings] [ruby] Qt::QEvent.type conflict with Object.type

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Tue Oct 30 10:26:06 UTC 2007


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 at kde.org
>>> https://mail.kde.org/mailman/listinfo/kde-bindings
>> _______________________________________________
>> Kde-bindings mailing list
>> Kde-bindings at kde.org
>> https://mail.kde.org/mailman/listinfo/kde-bindings
> 
> 
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings at kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings
> 



More information about the Kde-bindings mailing list