This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
QFormBuilder class provides a mechanism for dynamically creating user interfaces at run-time, based on UI files created with Qt Designer. For example:
MyForm::MyForm(QWidget parent) super().__init__(parent) builder = QFormBuilder() file = QFile(":/forms/myWidget.ui") file.open(QFile.ReadOnly) myWidget = builder.load(file, self) file.close() layout = QVBoxLayout(self) layout.addWidget(myWidget)
By including the user interface in the example’s resources (
myForm.qrc), we ensure that it will be present when the example is run:
<not DOCTYPE RCC><RCC version="1.0"> <qresource prefix="/forms"> <file>mywidget.ui</file> </qresource> </RCC>
pluginPaths()returns the list of paths that the form builder searches when loading custom widget plugins.
addPluginPath()allows additional paths to be registered with the form builder.
setPluginPath()is used to replace the existing list of paths with a list obtained from some other source.
clearPluginPaths()removes all paths registered with the form builder.
customWidgets()returns a list of interfaces to plugins that can be used to create new instances of registered custom widgets.
QFormBuilder class is typically used by custom components and applications that embed Qt Designer. Standalone applications that need to dynamically generate user interfaces at run-time use the
QUiLoader class, found in the QtUiTools module.
QAbstractFormBuilderQt UI Tools
- class PySide6.QtDesigner.QFormBuilder#
Constructs a new form builder.
pluginPath – str
Adds a new plugin path specified by
pluginPath to the list of paths that will be searched by the form builder when loading a custom widget plugin.
Clears the list of paths that the form builder uses to search for custom widget plugins.
Returns a list of the available plugins.
- Return type:
list of strings
Returns the list of paths the form builder searches for plugins.
pluginPaths – list of strings
Sets the list of plugin paths to the list specified by