def transverseWidgets(layout):
    """Get all widgets inside of the given layout and the sub-layouts"""
    w_lists = []
    for i in range(layout.count()):
        item = layout.itemAt(i)
        if item.layout():
            # if type(item) == QtGui.QLayoutItem:
            w_lists.extend(transverseWidgets(item.layout()))
            # if type(item) == QtGui.QWidgetItem:
        if item.widget():
            w = item.widget()
            w_lists.append(w)
            if w.layout():
                w_lists.extend(transverseWidgets(w.layout()))
    return w_lists