Class: Qt::MetaInfo

Inherits:
Object show all
Defined in:
lib/Qt/qtruby4.rb,
ext/ruby/qtruby/src/lib/Qt/qtruby4.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ MetaInfo

Returns a new instance of MetaInfo.



2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
# File 'lib/Qt/qtruby4.rb', line 2983

def initialize(klass)
	Meta[klass.name] = self
	@klass = klass
	@metaobject = nil
	@signals = []
	@slots = []
	@classinfos = []
	@dbus = false
	@changed = false
	Internal.addMetaObjectMethods(klass)
end

Instance Attribute Details

#changedObject

Returns the value of attribute changed.



2981
2982
2983
# File 'lib/Qt/qtruby4.rb', line 2981

def changed
  @changed
end

#classinfosObject

Returns the value of attribute classinfos.



2981
2982
2983
# File 'lib/Qt/qtruby4.rb', line 2981

def classinfos
  @classinfos
end

#dbusObject

Returns the value of attribute dbus.



2981
2982
2983
# File 'lib/Qt/qtruby4.rb', line 2981

def dbus
  @dbus
end

#metaobjectObject

Returns the value of attribute metaobject.



2981
2982
2983
# File 'lib/Qt/qtruby4.rb', line 2981

def metaobject
  @metaobject
end

#mocargsObject

Returns the value of attribute mocargs.



2981
2982
2983
# File 'lib/Qt/qtruby4.rb', line 2981

def mocargs
  @mocargs
end

#signalsObject

Returns the value of attribute signals.



2981
2982
2983
# File 'lib/Qt/qtruby4.rb', line 2981

def signals
  @signals
end

#slotsObject

Returns the value of attribute slots.



2981
2982
2983
# File 'lib/Qt/qtruby4.rb', line 2981

def slots
  @slots
end

Instance Method Details

#add_classinfo(key, value) ⇒ Object



3048
3049
3050
3051
3052
3053
# File 'lib/Qt/qtruby4.rb', line 3048

def add_classinfo(key, value)
	@classinfos.push [key, value]
	if key == 'D-Bus Interface'
		@dbus = true
	end
end

#add_signals(signal_list, access) ⇒ Object



2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
# File 'lib/Qt/qtruby4.rb', line 2995

def add_signals(signal_list, access)
	signal_names = []
	signal_list.each do |signal|
		if signal.kind_of? Symbol
			signal = signal.to_s + "()"
		end
		signal = Qt::MetaObject.normalizedSignature(signal).to_s
		if signal =~ /^(([\w,<>:]*)\s+)?([^\s]*)\((.*)\)/
			@signals.push QObjectMember.new(	$3, 
			                                    $3 + "(" + $4 + ")", 
			                                    $4, 
			                                    ($2 == 'void' || $2.nil?) ? "" : $2,
			                                    access )
			signal_names << $3
		else
			qWarning( "#{@klass.name}: Invalid signal format: '#{signal}'" )
		end
	end
	Internal.addSignalMethods(@klass, signal_names)
end

#add_slots(slot_list, access) ⇒ Object



3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
# File 'lib/Qt/qtruby4.rb', line 3030

def add_slots(slot_list, access)
	slot_list.each do |slot|
		if slot.kind_of? Symbol
			slot = slot.to_s + "()"
		end
		slot = Qt::MetaObject.normalizedSignature(slot).to_s
		if slot =~ /^(([\w,<>:]*)\s+)?([^\s]*)\((.*)\)/
			@slots.push QObjectMember.new(	$3, 
			                                $3 + "(" + $4 + ")", 
			                                $4, 
			                                ($2 == 'void' || $2.nil?) ? "" : $2,
			                                access )
		else
			qWarning( "#{@klass.name}: Invalid slot format: '#{slot}'" )
		end
	end
end

#get_signalsObject

Return a list of signals, including inherited ones



3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
# File 'lib/Qt/qtruby4.rb', line 3017

def get_signals
	all_signals = []
	current = @klass
	while current != Qt::Base
		meta = Meta[current.name]
		if !meta.nil?
			all_signals.concat meta.signals
		end
		current = current.superclass
	end
	return all_signals
end