Class: QgsLayoutComboBox

The QgsLayoutComboBox class is a combo box which displays available layouts from a QgsLayoutManager.

Added in version 3.8.

QgsLayoutComboBox in the collapsed state

QgsLayoutComboBox in the collapsed state

QgsLayoutComboBox in the expanded state

QgsLayoutComboBox in the expanded state

Class Hierarchy

Inheritance diagram of qgis.gui.QgsLayoutComboBox

Base classes

QComboBox

QWidget

QObject

QPaintDevice

Methods

allowEmptyLayout

Returns True if the combobox includes the empty layout ("not set") choice.

currentLayout

Returns the layout currently selected in the combo box.

filters

Returns the current filters used for filtering available layouts.

layout

Returns the layout at the specified index.

setAllowEmptyLayout

Sets whether an optional empty layout ("not set") option is present in the combobox.

setCurrentLayout

Sets the currently selected layout in the combo box.

setFilters

Sets the current filters used for filtering available layouts.

setLayoutManager

Sets the layout manager containing the layouts to list in the combo box.

Signals

layoutChanged

Emitted whenever the currently selected layout changes

class qgis.gui.QgsLayoutComboBox[source]

Bases: QComboBox

__init__(parent: QWidget | None = None, manager: QgsLayoutManager | None = None)

QgsLayoutComboBox creates a combo box to display a list of items in a layout manager. The layouts can optionally be filtered by type.

Parameters:
allowEmptyLayout(self) bool[source]

Returns True if the combobox includes the empty layout (“not set”) choice.

Return type:

bool

currentLayout(self) QgsMasterLayoutInterface | None[source]

Returns the layout currently selected in the combo box.

Return type:

Optional[QgsMasterLayoutInterface]

filters(self) QgsLayoutManagerProxyModel.Filters[source]

Returns the current filters used for filtering available layouts.

See also

setFilters()

Return type:

QgsLayoutManagerProxyModel.Filters

layout(self, index: int) QgsMasterLayoutInterface | None[source]

Returns the layout at the specified index.

Parameters:

index (int)

Return type:

Optional[QgsMasterLayoutInterface]

signal layoutChanged(layout: QgsMasterLayoutInterface)[source]

Emitted whenever the currently selected layout changes

Parameters:

layout (QgsMasterLayoutInterface)

setAllowEmptyLayout(self, allowEmpty: bool)[source]

Sets whether an optional empty layout (“not set”) option is present in the combobox.

Parameters:

allowEmpty (bool)

setCurrentLayout(self, layout: QgsMasterLayoutInterface | None)[source]

Sets the currently selected layout in the combo box.

Parameters:

layout (Optional[QgsMasterLayoutInterface])

setFilters(self, filters: QgsLayoutManagerProxyModel.Filters | QgsLayoutManagerProxyModel.Filter)[source]

Sets the current filters used for filtering available layouts.

See also

filters()

Parameters:

filters (Union[QgsLayoutManagerProxyModel.Filters, QgsLayoutManagerProxyModel.Filter])

setLayoutManager(self, manager: QgsLayoutManager | None)[source]

Sets the layout manager containing the layouts to list in the combo box.

Parameters:

manager (Optional[QgsLayoutManager])