QgsRasterBandComboBox class

A combobox widget which displays the bands present in a raster layer.

Constructors, destructors, conversion operators

QgsRasterBandComboBox(QWidget* parent = nullptr)
Constructor for QgsRasterBandComboBox.

Public functions

auto currentBand() const -> int
Returns the current band number selected in the combobox, or -1 if no band is selected.
auto isShowingNotSetOption() const -> bool
Returns true if the combo box is showing the "not set" option.
auto layer() const -> QgsRasterLayer*
Returns the layer currently associated with the combobox.
void setShowNotSetOption(bool show, const QString& string = QString())
Sets whether the combo box should show the "not set" option.

Signals

void bandChanged(int band)
This signal is emitted when the currently selected band changes.

Public slots

void setBand(int band)
Sets the current band number selected in the combobox.
void setLayer(QgsMapLayer* layer)
Sets the raster layer for which the bands are listed in the combobox.

Function documentation

int QgsRasterBandComboBox::currentBand() const

Returns the current band number selected in the combobox, or -1 if no band is selected.

bool QgsRasterBandComboBox::isShowingNotSetOption() const

Returns true if the combo box is showing the "not set" option.

QgsRasterLayer* QgsRasterBandComboBox::layer() const

Returns the layer currently associated with the combobox.

void QgsRasterBandComboBox::setShowNotSetOption(bool show, const QString& string = QString())

Sets whether the combo box should show the "not set" option.

Optionally the built in "not set" text can be overridden by specifying a string.

void QgsRasterBandComboBox::setBand(int band) public slot

Sets the current band number selected in the combobox.

void QgsRasterBandComboBox::setLayer(QgsMapLayer* layer) public slot

Sets the raster layer for which the bands are listed in the combobox.

If no layer is set or a non-raster layer is set then the combobox will be empty.