edifice.App.export_widgets

edifice.App.export_widgets#

App.export_widgets()[source]#

Exports the underlying Qt QWidgets s from the Edifice Elements in the ExportList.

Returns a list of QtWidgets.QWidget.

These QWidget s are still managed by Edifice, they will still benefit from full reactivity and state consistency. You can mount these widgets to your pre-existing Qt application this way:

# Suppose parent_widget is defined in Qt code.

@component
def export_elements(self):
    with ExportList():
        MyAwesomeComponent()
        AnotherComponent()

edifice_app = edifice.App(export_elements(), create_application=False)
edifice_widgets = edifice_app.export_widgets()

edifice_widgets[0].setParent(parent_widget)
parent_widget.layout().add_widget(edifice_widgets[0])

edifice_widgets[1].setParent(parent_widget)
parent_widget.layout().add_widget(edifice_widgets[1])
Return type:

list[QWidget]