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



759
760
761
762
763
764
765
766
767
768
769
770
771
# File 'lib/Qt/qtruby4.rb', line 759

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



744
745
746
747
748
749
750
751
752
753
754
755
756
757
# File 'lib/Qt/qtruby4.rb', line 744

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