平臺:QtRuby發出不起作用
達爾文* - * S-的MacBook,Pro.local 11.4.2 Darwin內核版本11.4.2:週四08月23日16點25分48秒PDT 2012;根:XNU-1699.32.7〜1/RELEASE_X86_64 x86_64的
紅寶石:
紅寶石2.0.0p0(2013年2月24日修訂版39474)[x86_64的-darwin11.4.2](安裝由RVM)
Qt的:
QT:穩定4.8.4(BOT TLED),HEAD
代碼:
require 'Qt'
class Foo < Qt::Object
signals :my_signal #also tried 'my_signal()'
slots 'my_slot()'
def initialize(parent = nil)
super(parent)
puts "connecting signal and slot"
Qt::Object.connect(self, SIGNAL('my_signal()'), self, SLOT('my_slot()'))
# also tried => connect(self, SIGNAL('my_signal()'), self, SLOT('my_slot()'))
end
def emit_my_signal
puts "sending signal"
emit my_signal
end
def my_slot
puts "received message from signal"
end
end
o = Foo.new
o.emit_my_signal
輸出:
connecting signal and slot
sending signal
輸出與Qt.debug_level = Qt的:: DEBUGLEVEL ::高
Munged method names:
QObject$
QObject?
QObject#
candidate list:
QObject* QObject::QObject(QObject*) (smoke: 0 index: 3804)
matching => smoke: 0 index: 3804
QObject* (u) score: 2
match => smoke: 0 index: 3804 score: 2 chosen: 3804
setCurrentMethod(smokeList index: 0, meth index: 3804)
connecting signal and slot
Searching for QObject#connect
Munged method names:
connect#$#$
candidate list:
static bool QObject::connect(const QObject*, const char*, const QObject*, const char*) (smoke: 0 index: 3850)
matching => smoke: 0 index: 3850
const QObject* (QObject) score: 3
const char* (s) score: 1
const QObject* (QObject) score: 3
const char* (s) score: 1
match => smoke: 0 index: 3850 score: 8 chosen: 3850
setCurrentMethod(smokeList index: 0, meth index: 3850)
sending signal
它似乎放射不做任何事情。我也曾嘗試重新安裝qt和qtbindings,但問題仍然存在。而且我也嘗試過在同一臺機器上使用信號和插槽的PyQt,它就像一個魅力。
有沒有人對此有任何想法?這是一個紅寶石qtbindings的錯誤,或者我做錯了什麼?
看來紅寶石紅寶石2.0.0-P0的錯誤,qtbindings不能很好地與這個版本。我在同一臺機器上試過ruby-1.9.3-p392,它工作。 – user2201409 2013-03-23 14:05:23
適用於qtbindings 4.8.5.2和ruby 2.0.0p247(2013-06-27修訂版41674)[i686-linux] – 2014-01-21 10:16:15
您的代碼在Ubuntu 15.10上使用qtbindings 4.8.6。 – bogl 2016-01-11 09:02:27