diff options
Diffstat (limited to 'sources/pyside2/doc/extras/QtUiTools.loadUiType.rst')
-rw-r--r-- | sources/pyside2/doc/extras/QtUiTools.loadUiType.rst | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/sources/pyside2/doc/extras/QtUiTools.loadUiType.rst b/sources/pyside2/doc/extras/QtUiTools.loadUiType.rst deleted file mode 100644 index 9ca330dea..000000000 --- a/sources/pyside2/doc/extras/QtUiTools.loadUiType.rst +++ /dev/null @@ -1,36 +0,0 @@ -.. currentmodule:: PySide2.QtUiTools -.. _loadUiType: - -loadUiType -*********** - -.. py:function:: loadUiType(uifile: str) -> tuple(object, object) - - :param str uifile: The name of the `.ui` file - :return: tuple(object, object) - - This function generates and loads a `.ui` file at runtime, and it returns - a `tuple` containing the reference to the Python class, and the base class. - - We recommend not to use this approach as the workflow should be to generate a Python file - from the `.ui` file, and then import and load it to use it, but we do understand that - there are some corner cases when such functionality is required. - - The internal process relies on `uic` being in the PATH. - The `pyside2-uic` wrapper uses a shipped `uic` that is located in the - `site-packages/PySide2/uic`, so PATH needs to be updated to use that if there - is no `uic` in the system. - - A simple use case is:: - - from PySide2.QtUiTools import loadUiType - - generated_class, base_class = loadUiType("themewidget.ui") - # the values will be: - # (<class '__main__.Ui_ThemeWidgetForm'>, <class 'PySide2.QtWidgets.QWidget'>) - - widget = base_class() - form = generated_class() - form.setupUi(widget) - # form.a_widget_member.a_method_of_member() - widget.show() |