QAbstractFormBuilder

The QAbstractFormBuilder class provides a default implementation for classes that create user interfaces at run-time. More

Inheritance diagram of PySide6.QtDesigner.QAbstractFormBuilder

Synopsis

Functions

Virtual functions

Static functions

Detailed Description

QAbstractFormBuilder provides a standard interface and a default implementation for constructing forms from user interface files. It is not intended to be instantiated directly. Use the QFormBuilder class to create user interfaces from UI files at run-time. For example:

MyForm::MyForm(QWidget *parent)
    : QWidget(parent)
{
    QFormBuilder builder;
    QFile file(":/forms/myWidget.ui");
    file.open(QFile::ReadOnly);
    QWidget *myWidget = builder.load(&file, this);
    file.close();

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(myWidget);
    setLayout(layout);
}

To override certain aspects of the form builder’s behavior, subclass QAbstractFormBuilder and reimplement the relevant virtual functions:

  • handles reading of UI format files from arbitrary QIODevices, and construction of widgets from the XML data that they contain.

  • handles saving of widget details in UI format to arbitrary QIODevices.

  • workingDirectory() and setWorkingDirectory() control the directory in which forms are held. The form builder looks for other resources on paths relative to this directory.

The 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 , found in the Qt UI Tools module.

See also

Qt UI Tools

class PySide6.QtDesigner.QAbstractFormBuilder

Constructs a new form builder.

PySide6.QtDesigner.QAbstractFormBuilder.addMenuAction(action)
Parameters

actionPySide6.QtGui.QAction

PySide6.QtDesigner.QAbstractFormBuilder.applyPropertyInternally(o, propertyName, value)
Parameters
Return type

bool

PySide6.QtDesigner.QAbstractFormBuilder.checkProperty(obj, prop)
Parameters
Return type

bool

PySide6.QtDesigner.QAbstractFormBuilder.createAction(parent, name)
Parameters
Return type

PySide6.QtGui.QAction

PySide6.QtDesigner.QAbstractFormBuilder.createActionGroup(parent, name)
Parameters
Return type

PySide6.QtGui.QActionGroup

PySide6.QtDesigner.QAbstractFormBuilder.createLayout(layoutName, parent, name)
Parameters
Return type

PySide6.QtWidgets.QLayout

PySide6.QtDesigner.QAbstractFormBuilder.createWidget(widgetName, parentWidget, name)
Parameters
Return type

PySide6.QtWidgets.QWidget

PySide6.QtDesigner.QAbstractFormBuilder.errorString()
Return type

str

Returns a human-readable description of the last error occurred in .

See also

load()

PySide6.QtDesigner.QAbstractFormBuilder.load(dev[, parentWidget=None])
Parameters
Return type

PySide6.QtWidgets.QWidget

PySide6.QtDesigner.QAbstractFormBuilder.reset()
PySide6.QtDesigner.QAbstractFormBuilder.save(dev, widget)
Parameters
PySide6.QtDesigner.QAbstractFormBuilder.setWorkingDirectory(directory)
Parameters

directoryPySide6.QtCore.QDir

Sets the current working directory of the form builder to the specified directory.

static PySide6.QtDesigner.QAbstractFormBuilder.toolBarAreaMetaEnum()
Return type

PySide6.QtCore.QMetaEnum

PySide6.QtDesigner.QAbstractFormBuilder.workingDirectory()
Return type

PySide6.QtCore.QDir

Returns the current working directory of the form builder.