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

Reply via email to