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



1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
# File 'lib/Qt/qtruby4.rb', line 1512

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



1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
# File 'lib/Qt/qtruby4.rb', line 1526

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



1447
1448
1449
1450
1451
1452
1453
# File 'lib/Qt/qtruby4.rb', line 1447

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



1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
# File 'lib/Qt/qtruby4.rb', line 1539

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



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

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



1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
# File 'lib/Qt/qtruby4.rb', line 1492

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



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

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