Class: Qt::MetaObject

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

Instance Method Summary collapse

Methods inherited from Base

#%, #&, #*, #**, #+, #-, #[email protected], #/, #<, #<<, #<=, #==, #>, #>=, #>>, #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


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

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


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

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


1431
1432
1433
1434
1435
1436
1437
# File 'lib/Qt/qtruby4.rb', line 1431

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


1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
# File 'lib/Qt/qtruby4.rb', line 1523

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


1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
# File 'lib/Qt/qtruby4.rb', line 1442

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


1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
# File 'lib/Qt/qtruby4.rb', line 1476

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


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

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