def get_all_widgets_in_layout(layout):
    """
    Recursively gets all the items of a layout

    :param layout: <QLayout>
    :return:
    """

    def get_children(item):
        try:
            for index in range(item.count()):
                yield item.itemAt(index).widget()

                for index_2 in get_children(item.itemAt(index)):
                    yield index_2
        except:
            pass

    children = get_children(layout)
    return [child for child in children if child is not None]