Class: Qt::MetaObject

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

Instance Method Summary collapse

Methods inherited from Base

#%, #&, #*, #**, #+, #-, #-@, #/, #<, #<<, #<=, #==, #>, #>=, #>>, #^, #methods, #protected_methods, #public_methods, q_classinfo, q_signal, q_slot, signals, #singleton_methods, slots, #|, #~

Instance Method Details

#enumerators(inherits = false) ⇒ Object



1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
# File 'lib/qt/qtruby4.rb', line 1045

def enumerators(inherits = false)
  res = []
  if inherits
    for e in 0...enumeratorCount()
      res.push enumerator(e)
    end
  else
    for e in enumeratorOffset()...enumeratorCount()
      res.push enumerator(e)
    end
  end
  return res
end

#inspectObject



1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
# File 'lib/qt/qtruby4.rb', line 1059

def inspect
  str = super
  str.sub!(/>$/, "")
  str << " className=%s," % className
  str << " propertyNames=Array (%d element(s))," % propertyNames.length unless propertyNames.length == 0
  str << " signalNames=Array (%d element(s))," % signalNames.length unless signalNames.length == 0
  str << " slotNames=Array (%d element(s))," % slotNames.length unless slotNames.length == 0
  str << " enumerators=Array (%d element(s))," % enumerators.length unless enumerators.length == 0
  str << " superClass=%s," % superClass.inspect unless superClass == nil
  str.chop!
  str << ">"
end

#method(*args) ⇒ Object



980
981
982
983
984
985
986
# File 'lib/qt/qtruby4.rb', line 980

def method(*args)
          if args.length == 1 && args[0].kind_of?(Symbol)
    super(*args)
  else
    method_missing(:method, *args)
  end
end

#pretty_print(pp) ⇒ Object



1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
# File 'lib/qt/qtruby4.rb', line 1072

def pretty_print(pp)
  str = to_s
  str.sub!(/>$/, "")
  str << "\n className=%s," % className
  str << "\n propertyNames=Array (%d element(s))," % propertyNames.length unless propertyNames.length == 0
  str << "\n signalNames=Array (%d element(s))," % signalNames.length unless signalNames.length == 0
  str << "\n slotNames=Array (%d element(s))," % slotNames.length unless slotNames.length == 0
  str << "\n enumerators=Array (%d element(s))," % enumerators.length unless enumerators.length == 0
  str << "\n superClass=%s," % superClass.inspect unless superClass == nil
  str << "\n methodCount=%d," % methodCount
  str << "\n methodOffset=%d," % methodOffset
  str << "\n propertyCount=%d," % propertyCount
  str << "\n propertyOffset=%d," % propertyOffset
  str << "\n enumeratorCount=%d," % enumeratorCount
  str << "\n enumeratorOffset=%d," % enumeratorOffset
  str.chop!
  str << ">"
  pp.text str
end

#propertyNames(inherits = false) ⇒ Object

Add three methods, ‘propertyNames()’, ‘slotNames()’ and ‘signalNames()’ from Qt3, as they are very useful when debugging



991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
# File 'lib/qt/qtruby4.rb', line 991

def propertyNames(inherits = false)
  res = []
  if inherits
    for p in 0...propertyCount() 
      res.push property(p).name
    end
  else
    for p in propertyOffset()...propertyCount()
      res.push property(p).name
    end
  end
  return res
end

#signalNames(inherits = false) ⇒ Object



1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
# File 'lib/qt/qtruby4.rb', line 1025

def signalNames(inherits = false)
  res = []
  if inherits
    for m in 0...methodCount()
      if method(m).methodType == Qt::MetaMethod::Signal 
        res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName, 
                  method(m).signature]
      end
    end
  else
    for m in methodOffset()...methodCount()
      if method(m).methodType == Qt::MetaMethod::Signal 
        res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName, 
                  method(m).signature]
      end
    end
  end
  return res
end

#slotNames(inherits = false) ⇒ Object



1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
# File 'lib/qt/qtruby4.rb', line 1005

def slotNames(inherits = false)
  res = []
  if inherits
    for m in 0...methodCount()
      if method(m).methodType == Qt::MetaMethod::Slot 
        res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName, 
                  method(m).signature]
      end
    end
  else
    for m in methodOffset()...methodCount()
      if method(m).methodType == Qt::MetaMethod::Slot 
        res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName, 
                  method(m).signature]
      end
    end
  end
  return res
end