2
im使用qtbindings为红宝石(https://github.com/ryanmelt/qtbindings) ,我将发射用散列PARAM的信号...QT Ruby绑定信号时隙与散列PARAM
喜欢的东西这样的:
require 'Qt'
class Foo < Qt::Object
signals 'my_signal(Hash)'
slots 'my_slot(Hash)'
def initialize(parent = nil)
super(parent)
connect(self, SIGNAL('my_signal(Hash)'), self, SLOT('my_slot(Hash)'))
end
def emit_my_signal
emit my_signal({:foo => :bar})
end
def my_slot(hash)
puts hash.inspect
end
end
o = Foo.new
o.emit_my_signal
如果我运行此脚本,我得到的错误:Cannot handle 'Hash' as slot argument (ArgumentError).
如果我使用的int
代替Hash
一切都很好。
有一种方法可以做到这一点??怎么样?
谢谢。
我检查还HTTP:// techbase.kde.org/Development/Languages/Ruby#Emitting_Ruby_Classes但似乎不适合我... – Pioz
理查德戴尔建议我使用const QMap&'。 –
Pioz