Class: Qt::MetaObject

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, #|, #~

Instance Method Details

#enumerators(inherits = false) ⇒ Object



1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
# File 'lib/Qt/qtruby4.rb', line 1475

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



1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
# File 'lib/Qt/qtruby4.rb', line 1489

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



1410
1411
1412
1413
1414
1415
1416
# File 'lib/Qt/qtruby4.rb', line 1410

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



1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
# File 'lib/Qt/qtruby4.rb', line 1502

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



1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
# File 'lib/Qt/qtruby4.rb', line 1421

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



1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
# File 'lib/Qt/qtruby4.rb', line 1455

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



1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
# File 'lib/Qt/qtruby4.rb', line 1435

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