Sorry, the lack of parenthesis was a typo. There should be parenthesis around both of those, but it still doesn't work with them.
class FooClass def someMethod() end end $foo = FooClass.new $object_action.signal_changed.connect($foo, "someMethod()") On Sat, Oct 30, 2010 at 7:47 PM, Samu Voutilainen <[email protected]> wrote: > On Sunday 31 October 2010 04:43:50 Josh Stratton wrote: >> Hey, I can just change it to QWidget, and I get a connection function >> now. This is wonderful! One other question, though. Is there a way >> to create custom slots in just ruby? Right now if I inherit from a >> java class like InputStream >> >> include_class "java.io.InputStream" >> class MyStream < InputStream >> def available() >> puts("great") >> return 3 >> end >> end >> $stream = MyStream.new >> $object_action.signal_changed.connect($stream, "available()") >> >> and the available function is called when that button throws the >> signal "changed". However, I can't seem to do this with a jruby class >> like >> >> class FooClass >> def someMethod >> end >> end >> $foo = FooClass.new >> $object_action.signal_changed.connect($foo, "someMethod") >> >> I guess I could just write abstract classes (maybe even interfaces) in >> java, which isn't a huge deal, but I was wondering if there were a >> more direct way. >> >> On Sat, Oct 30, 2010 at 5:08 AM, Josh Stratton <[email protected]> >> wrote: >> >> You can expose them like this: >> >> >> >> class com.trolltech.qt.gui::QWidget >> >> def method_missing(sym) >> >> if sym.id2name.start_with?("signal_") >> >> name = sym.id2name[7, sym.id2name.length] >> >> f = self.getClass.fields.select {|f| f.name == name }.first >> >> f.get(self) >> >> else >> >> nil >> >> end >> >> end >> >> end >> > >> > Does this work similarly for QAction? >> > >> >> _______________________________________________ >> Qt-jambi-interest mailing list >> [email protected] >> http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest >> > > I wonder if that example of your should have () in the call in order it to > work. After all, it works in Java / Cpp stage, not really ruby... > > Declaration of slots should be exactly same than it is in Java stage, I > suppose? > > -- > Terveisin, > Samu Voutilainen > http://smar.fi > _______________________________________________ > Qt-jambi-interest mailing list > [email protected] > http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest > _______________________________________________ Qt-jambi-interest mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
