from qt import *
from qtui import *


def findChildren(widget):
    all = [widget]
    children = widget.children()
    for child in children:
        all.extend(findChildren(child))

    return all

app = QApplication([])

# 1. Not keeping own reference
w = QWidget()
l = QVBoxLayout(w)
l.addWidget(QWidgetFactory.create('form1.ui', None, w))

# 2. Keeping own reference
#w = QWidget()
#l = QVBoxLayout(w)
#a = QWidgetFactory.create('form1.ui', None, w)
#l.addWidget(a)

app.setMainWidget(w)
w.show()

print findChildren(w)

app.exec_loop()
