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



824
825
826
827
828
829
830
831
832
833
834
835
836
# File 'lib/Qt/qtruby4.rb', line 824

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



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

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