QgsLayoutItemComboBox class

The QgsLayoutItemComboBox class is a combo box which displays items of a matching type from a layout.

Constructors, destructors, conversion operators

QgsLayoutItemComboBox(QWidget* parent = nullptr, QgsLayout* layout = nullptr) explicit
QgsLayoutItemComboBox creates a combo box to display a list of items in a layout.

Public functions

auto currentItem() const -> QgsLayoutItem*
Returns the item currently selected in the combo box.
auto exceptedItemList() const -> QList<QgsLayoutItem*>
Returns the list of specific items excluded from the combo box.
auto item(int index) const -> QgsLayoutItem*
Returns the item currently shown at the specified index within the combo box.
auto itemType() const -> QgsLayoutItemRegistry::ItemType
Returns the filter for the item types to show in the combo box.
void setCurrentLayout(QgsLayout* layout)
Sets the layout containing the items to list in the combo box.
void setExceptedItemList(const QList<QgsLayoutItem*>& exceptList)
Sets a list of specific items to exclude from the combo box.
void setItemType(QgsLayoutItemRegistry::ItemType itemType)
Sets a filter for the item type to show in the combo box.

Signals

void itemChanged(QgsLayoutItem* item)
Emitted whenever the currently selected item changes.

Public slots

void setItem(const QgsLayoutItem* item)
Sets the currently selected item in the combo box.

Function documentation

QgsLayoutItemComboBox::QgsLayoutItemComboBox(QWidget* parent = nullptr, QgsLayout* layout = nullptr) explicit

QgsLayoutItemComboBox creates a combo box to display a list of items in a layout.

The items can optionally be filtered by type. If layout is not set, no items will be shown until setCurrentLayout() is called

QList<QgsLayoutItem*> QgsLayoutItemComboBox::exceptedItemList() const

Returns the list of specific items excluded from the combo box.

QgsLayoutItem* QgsLayoutItemComboBox::item(int index) const

Returns the item currently shown at the specified index within the combo box.

QgsLayoutItemRegistry::ItemType QgsLayoutItemComboBox::itemType() const

Returns the filter for the item types to show in the combo box.

void QgsLayoutItemComboBox::setExceptedItemList(const QList<QgsLayoutItem*>& exceptList)

Sets a list of specific items to exclude from the combo box.

void QgsLayoutItemComboBox::setItemType(QgsLayoutItemRegistry::ItemType itemType)

Sets a filter for the item type to show in the combo box.

Parameters
itemType type of items to show. Set to QgsLayoutItemRegistry::LayoutItem to show all items.