module Vizkit::QtTypelibExtension

Public Instance Methods

method_info() click to toggle source
# File lib/vizkit/typelib_qt_adapter.rb, line 169
def method_info
    @qt_object_adapter ||= Vizkit::TypelibQtAdapter.new(self) 
    @qt_object_adapter.method_info
end
method_missing(m, *args, &block) click to toggle source
Calls superclass method
# File lib/vizkit/typelib_qt_adapter.rb, line 174
def method_missing(m, *args, &block)
    if m == :metaObject
        return super
    end

    @qt_object_adapter ||= Vizkit::TypelibQtAdapter.new(self)
    successful, return_type =
        begin
            @qt_object_adapter.call_qt_method(m.to_s, args)
        rescue TypelibQtCallError => e
            backtrace = caller
            if respond_to?(:plugin_spec)
                backtrace = ["#{backtrace[0].gsub(/in `\w+'/, "exception from C++ method #{plugin_spec.plugin_name}::#{m.to_s}")}"] + backtrace[1..-1]
            end
            Kernel.raise e, e.message, backtrace
        end

    if successful
        # Should be the return value
        return_type
    else
        # check if any parameter is a typelib object because this would cause a segfault if
        # the superclass is a Qt::Object
        if args.any? { |arg| arg.is_a? Typelib::Type}
            Kernel.raise NoMethodError.new "undefined method '#{m}' for #{self}"
        else
            super
        end
    end
end