Ejemplo n.º 1
0
 def event(self, e):
     print 'event()', self, e
     return QObject.event(self, e)
Ejemplo n.º 2
0
 def eventFilter(self, watched, event):
      print 'eventFilter()', watched, event
      return QObject.eventFilter(self, watched, event)
Ejemplo n.º 3
0
 def connectNotify(self, signal):
     print 'connectNotify()', self, signal
     QObject.connectNotify(self, signal)
Ejemplo n.º 4
0
 def childEvent(self, e):
     print 'childEvent', e
     #return QObject.protected_childEvent(self, e)
     return QObject.childEvent(self, e)
Ejemplo n.º 5
0
from Qt.Core import QObject, QEvent, factory
from Qt.Gui import QApplication, QWidget

app = QApplication()

a = QObject(None)
b = QObject(None)
c = QObject(None)

print a, b, c
print a.parent(), b.parent(), c.parent()

a.setParent(b)
b.setParent(c)
#c.setParent(a)

print a.parent(), b.parent(), c.parent()
Ejemplo n.º 6
0
# parental test

from Qt.Core import QObject

a = QObject(None)
b = QObject(a)

print 'a:', a
print 'b:', b
print 'a.parent():', a.parent()
print 'b.parent():', b.parent()

assert a == a
assert b == b
assert not (a == b)
assert not (b == a)
assert a.parent() == None
assert b.parent() == a
assert a == b.parent()
assert b.parent() == b.parent()

Ejemplo n.º 7
0
 def event(self, e):
     print e, e.type()
     return QObject.event(self, e)
Ejemplo n.º 8
0
 def __init__(self, parent=None):
     QObject.__init__(self, parent)
Ejemplo n.º 9
0
# try to leak memory
from Qt.Core import QObject, childrens, factory



print
print 'Test #1: parentless QObjects'
for i in range(3):
    a = QObject()
    a.objectName = 'a'+str(i)
    print 'creating a'+str(i), a

    
a = QObject()
a.objectName = 'a'
c = QObject(a)
#a.__children__ = []

print
print 'Test #2: parented QObjects'
print a, c
for i in range(3):
    b = QObject(a)
    #a.__children__.append(b)
    b.objectName = 'b'+str(i)
    print 'creating b'+str(i), b
    #c = factory(a)
    #print c
#del b
c.setParent(None)
Ejemplo n.º 10
0
# parent test

from Qt.Core import QObject
from Qt.Gui import QApplication, QPushButton

app = QApplication('app')
button = QPushButton('Push me', None)
a = QObject(button)
a.objectName = 'a'
button.objectName = 'button'

print button, a, a.parent()
print type(button), type(a), type(a.parent())
print button == a.parent()
for obj in [a, button, a.parent()]:
    print obj.objectName, obj
Ejemplo n.º 11
0
def f():     
    a = QObject(None)
    print 'a:',a
    a.connect('destroyed(QObject*)', on_destroy)
    del a