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



808
809
810
811
812
813
814
815
816
817
818
819
820
# File 'lib/Qt/qtruby4.rb', line 808

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



793
794
795
796
797
798
799
800
801
802
803
804
805
806
# File 'lib/Qt/qtruby4.rb', line 793

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