QDesignerWidgetBoxInterface

The QDesignerWidgetBoxInterface class allows you to control the contents of Qt Designer’s widget box. More

Inheritance diagram of PySide6.QtDesigner.QDesignerWidgetBoxInterface

Synopsis

Functions

Virtual functions

Detailed Description

QDesignerWidgetBoxInterface contains a collection of functions that is typically used to manipulate the contents of Qt Designer’s widget box.

Qt Designer uses an XML file to populate its widget box. The name of that file is one of the widget box’s properties, and you can retrieve it using the function.

QDesignerWidgetBoxInterface also provides the function that saves the contents of the widget box in the file specified by the widget box’s file name property. If you have made changes to the widget box, for example by dropping a widget into the widget box, without calling the function, the original content can be restored by a simple invocation of the function:

QDesignerWidgetBoxInterface *widgetBox = 0:
widgetBox = formEditor->widgetBox();

widgetBox->load();

The QDesignerWidgetBoxInterface class is not intended to be instantiated directly. You can retrieve an interface to Qt Designer’s widget box using the widgetBox() function. A pointer to Qt Designer’s current QDesignerFormEditorInterface object (formEditor in the example above) is provided by the function’s parameter. When implementing a custom widget plugin, you must subclass the QDesignerCustomWidgetInterface to expose your plugin to Qt Designer.

If you want to save your changes, and at the same time preserve the original contents, you can use the function combined with the function to save your changes into another file. Remember to store the name of the original file first:

QString originalFile = widgetBox->fileName();

widgetBox->setFileName("myWidgetBox.xml");
widgetBox->save();

Then you can restore the original contents of the widget box by resetting the file name to the original file and calling :

widgetBox->setFileName(originalFile);
widgetBox->load();

In a similar way, you can later use your customized XML file:

if (widgetBox->filename() != "myWidgetBox.xml") {
    widgetBox->setFileName("myWidgetBox.xml");
    widgetBox->load();
}
class PySide6.QtDesigner.QDesignerWidgetBoxInterface([parent=None[, flags=Qt.WindowFlags()]])
Parameters

Constructs a widget box interface with the given parent and the specified window flags.

PySide6.QtDesigner.QDesignerWidgetBoxInterface.addCategory(cat)
Parameters

catPySide6.QtDesigner.QDesignerWidgetBoxInterface.Category

PySide6.QtDesigner.QDesignerWidgetBoxInterface.addWidget(cat_idx, wgt)
Parameters
PySide6.QtDesigner.QDesignerWidgetBoxInterface.category(cat_idx)
Parameters

cat_idx – int

Return type

PySide6.QtDesigner.QDesignerWidgetBoxInterface.Category

PySide6.QtDesigner.QDesignerWidgetBoxInterface.categoryCount()
Return type

int

PySide6.QtDesigner.QDesignerWidgetBoxInterface.dropWidgets(item_list, global_mouse_pos)
Parameters
PySide6.QtDesigner.QDesignerWidgetBoxInterface.fileName()
Return type

str

PySide6.QtDesigner.QDesignerWidgetBoxInterface.findOrInsertCategory(categoryName)
Parameters

categoryName – str

Return type

int

PySide6.QtDesigner.QDesignerWidgetBoxInterface.load()
Return type

bool

PySide6.QtDesigner.QDesignerWidgetBoxInterface.removeCategory(cat_idx)
Parameters

cat_idx – int

PySide6.QtDesigner.QDesignerWidgetBoxInterface.removeWidget(cat_idx, wgt_idx)
Parameters
  • cat_idx – int

  • wgt_idx – int

PySide6.QtDesigner.QDesignerWidgetBoxInterface.save()
Return type

bool

PySide6.QtDesigner.QDesignerWidgetBoxInterface.setFileName(file_name)
Parameters

file_name – str

PySide6.QtDesigner.QDesignerWidgetBoxInterface.widget(cat_idx, wgt_idx)
Parameters
  • cat_idx – int

  • wgt_idx – int

Return type

PySide6.QtDesigner.QDesignerWidgetBoxInterface.Widget

PySide6.QtDesigner.QDesignerWidgetBoxInterface.widgetCount(cat_idx)
Parameters

cat_idx – int

Return type

int