使用DRb或EventMachine的QtRuby

3

我希望用Ruby和Qt编写一个应用程序,可以通过网络与其他实例通信。

如何将Qt的事件循环与DRb或EventMachine集成?

编辑:

我找到了答案,等我有时间了会发帖解释。

1个回答

6
require 'eventmachine'
require 'Qt4'

app = Qt::Application.new(ARGV)
hello_button = Qt::PushButton.new("Hello EventMachine")
hello_button.resize(100,20)
hello_button.show

EventMachine.run do
  EM.add_periodic_timer(0.01) do
    app.process_events
  end
end

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接