Class: Qt::DBusInterface

Inherits:
Base show all
Defined in:
lib/Qt/qtruby4.rb

Instance Method Summary collapse

Methods inherited from Base

#%, #&, #*, #**, #+, #-, #-@, #/, #<, #<<, #<=, #==, #>, #>=, #>>, #QCOMPARE, #QEXPECT_FAIL, #QFAIL, #QSKIP, #QTEST, #QVERIFY, #QVERIFY2, #QWARN, #^, ancestors, #is_a?, #methods, private_slots, #protected_methods, #public_methods, q_classinfo, q_signal, q_slot, signals, #singleton_methods, slots, #|, #~

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id, *args) ⇒ Object



787
788
789
790
791
792
793
794
795
796
797
798
799
# File 'lib/Qt/qtruby4.rb', line 787

def method_missing(id, *args)
  begin
    # First look for a method in the Smoke runtime
    # If not found, then throw an exception and try dbus.
    super(id, *args)
  rescue
    if args.length == 0
      return call(id.to_s).value
    else
      return call(id.to_s, *args).value
    end
  end
end

Instance Method Details

#call(method_name, *args) ⇒ Object



772
773
774
775
776
777
778
779
780
781
782
783
784
785
# File 'lib/Qt/qtruby4.rb', line 772

def call(method_name, *args)
  if args.length == 0
    return super(method_name)
  elsif method_name.is_a? Qt::Enum
    opt = args.shift
    qdbusArgs = args.collect {|arg| qVariantFromValue(arg)}
    return super(method_name, opt, *qdbusArgs)
  else
    # If the method is Qt::DBusInterface.call(), create an Array 
    # 'dbusArgs' of Qt::Variants from '*args'
    qdbusArgs = args.collect {|arg| qVariantFromValue(arg)}
    return super(method_name, *qdbusArgs)
  end
end