Subgroup: Map

Class: QgsMapLayerComboBox

class qgis.gui.QgsMapLayerComboBox

Bases: PyQt5.QtWidgets.QComboBox

The QgsMapLayerComboBox class is a combo box which displays the list of layers

New in version 2.3: Methods

acceptDrops
accessibleDescription
accessibleName
actionEvent
actions
activateWindow
addAction
addActions
addItem addItem(self, QIcon, str, userData: Any = None)
addItems
additionalItems Return the list of additional (non map layer) items included at the end of the combo box.
adjustSize
allowEmptyLayer Returns true if the combo box allows the empty layer (“not set”) choice.
autoFillBackground
backgroundRole
baseSize
blockSignals
changeEvent
childAt childAt(self, int, int) -> QWidget
childEvent
children
childrenRect
childrenRegion
clear
clearEditText
clearFocus
clearMask
close
closeEvent
colorCount
completer
connectNotify
contentsMargins
contentsRect
contextMenuEvent
contextMenuPolicy
count
create
createWindowContainer
currentData
currentIndex
currentLayer Returns the current layer selected in the combo box.
currentText
cursor
customEvent
deleteLater
depth
destroy
devType
devicePixelRatio
devicePixelRatioF
devicePixelRatioFScale
disconnect
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
dumpObjectInfo
dumpObjectTree
duplicatesEnabled
dynamicPropertyNames
effectiveWinId
ensurePolished
enterEvent
event
eventFilter
exceptedLayerList returns the list of excepted layers
excludedProviders Returns the list of data providers which are excluded from the combobox.
filters currently used filter on list layers
find
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
findData
findText
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPolicy
focusPreviousChild
focusProxy
focusWidget
font
fontInfo
fontMetrics
foregroundRole
frameGeometry
frameSize
geometry
getContentsMargins
grab
grabGesture
grabKeyboard
grabMouse grabMouse(self, Union[QCursor, Qt.CursorShape])
grabShortcut
graphicsEffect
graphicsProxyWidget
hasFocus
hasFrame
hasHeightForWidth
hasMouseTracking
hasTabletTracking
height
heightForWidth
heightMM
hide
hideEvent
hidePopup
iconSize
indexChanged
inherits
initPainter
initStyleOption
inputMethodEvent
inputMethodHints
inputMethodQuery inputMethodQuery(self, Qt.InputMethodQuery, Any) -> Any
insertAction
insertActions
insertItem insertItem(self, int, QIcon, str, userData: Any = None)
insertItems
insertPolicy
insertSeparator
installEventFilter
isActiveWindow
isAncestorOf
isEditable
isEnabled
isEnabledTo
isFullScreen
isHidden
isLeftToRight
isMaximized
isMinimized
isModal
isRightToLeft
isSignalConnected
isVisible
isVisibleTo
isWidgetType
isWindow
isWindowModified
isWindowType
itemData
itemDelegate
itemIcon
itemText
keyPressEvent
keyReleaseEvent
keyboardGrabber
killTimer
layer Return the layer currently shown at the specified index within the combo box.
layout
layoutDirection
leaveEvent
lineEdit
locale
logicalDpiX
logicalDpiY
lower
mapFrom
mapFromGlobal
mapFromParent
mapTo
mapToGlobal
mapToParent
mask
maxCount
maxVisibleItems
maximumHeight
maximumSize
maximumWidth
metaObject
metric
minimumContentsLength
minimumHeight
minimumSize
minimumSizeHint
minimumWidth
model
modelColumn
mouseDoubleClickEvent
mouseGrabber
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
move move(self, int, int)
moveEvent
moveToThread
nativeEvent
nativeParentWidget
nextInFocusChain
normalGeometry
objectName
overrideWindowFlags
overrideWindowState
paintEngine
paintEvent
paintingActive
palette
parent
parentWidget
physicalDpiX
physicalDpiY
pos
previousInFocusChain
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
raise_
receivers
rect
releaseKeyboard
releaseMouse
releaseShortcut
removeAction
removeEventFilter
removeItem
render render(self, QPainter, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.DrawWindowBackground|QWidget.DrawChildren))
repaint repaint(self, int, int, int, int)
resize resize(self, int, int)
resizeEvent
restoreGeometry
rootModelIndex
rowsChanged
saveGeometry
scroll scroll(self, int, int, QRect)
sender
senderSignalIndex
setAcceptDrops
setAccessibleDescription
setAccessibleName
setAdditionalItems Sets a list of additional (non map layer) items to include at the end of the combobox.
setAllowEmptyLayer Sets whether an optional empty layer (“not set”) option is shown in the combo box.
setAttribute
setAutoFillBackground
setBackgroundRole
setBaseSize setBaseSize(self, QSize)
setCompleter
setContentsMargins setContentsMargins(self, QMargins)
setContextMenuPolicy
setCurrentIndex
setCurrentText
setCursor
setDisabled
setDuplicatesEnabled
setEditText
setEditable
setEnabled
setExceptedLayerList except a list of layers not to be listed
setExcludedProviders Sets a list of data providers which should be excluded from the combobox.
setFilters setFilters allows fitering according to layer type and/or geometry type.
setFixedHeight
setFixedSize setFixedSize(self, int, int)
setFixedWidth
setFocus setFocus(self, Qt.FocusReason)
setFocusPolicy
setFocusProxy
setFont
setForegroundRole
setFrame
setGeometry setGeometry(self, int, int, int, int)
setGraphicsEffect
setHidden
setIconSize
setInputMethodHints
setInsertPolicy
setItemData
setItemDelegate
setItemIcon
setItemText
setLayer setLayer set the current layer selected in the combo
setLayout
setLayoutDirection
setLineEdit
setLocale
setMask setMask(self, QRegion)
setMaxCount
setMaxVisibleItems
setMaximumHeight
setMaximumSize setMaximumSize(self, QSize)
setMaximumWidth
setMinimumContentsLength
setMinimumHeight
setMinimumSize setMinimumSize(self, QSize)
setMinimumWidth
setModel
setModelColumn
setMouseTracking
setObjectName
setPalette
setParent setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType])
setProperty
setRootModelIndex
setShortcutAutoRepeat
setShortcutEnabled
setShowCrs Sets whether the CRS of layers is also included in the combo box text.
setSizeAdjustPolicy
setSizeIncrement setSizeIncrement(self, QSize)
setSizePolicy setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy)
setStatusTip
setStyle
setStyleSheet
setTabOrder
setTabletTracking
setToolTip
setToolTipDuration
setUpdatesEnabled
setValidator
setView
setVisible
setWhatsThis
setWindowFilePath
setWindowFlag
setWindowFlags
setWindowIcon
setWindowIconText
setWindowModality
setWindowModified
setWindowOpacity
setWindowRole
setWindowState
setWindowTitle
sharedPainter
show
showCrs Returns true if the combo box shows the layer’s CRS.
showEvent
showFullScreen
showMaximized
showMinimized
showNormal
showPopup
signalsBlocked
size
sizeAdjustPolicy
sizeHint
sizeIncrement
sizePolicy
stackUnder
startTimer
statusTip
style
styleSheet
tabletEvent
testAttribute
thread
timerEvent
toolTip
toolTipDuration
tr
underMouse
ungrabGesture
unsetCursor
unsetLayoutDirection
unsetLocale
update update(self, QRect)
updateGeometry
updateMicroFocus
updatesEnabled
validator
view
visibleRegion
whatsThis
wheelEvent
width
widthMM
winId
window
windowFilePath
windowFlags
windowHandle
windowIcon
windowIconText
windowModality
windowOpacity
windowRole
windowState
windowTitle
windowType
x
y

Attributes

AdjustToContents
AdjustToContentsOnFirstShow
AdjustToMinimumContentsLength
AdjustToMinimumContentsLengthWithIcon
DrawChildren
DrawWindowBackground
IgnoreMask
InsertAfterCurrent
InsertAlphabetically
InsertAtBottom
InsertAtCurrent
InsertAtTop
InsertBeforeCurrent
NoInsert
PdmDepth
PdmDevicePixelRatio
PdmDevicePixelRatioScaled
PdmDpiX
PdmDpiY
PdmHeight
PdmHeightMM
PdmNumColors
PdmPhysicalDpiX
PdmPhysicalDpiY
PdmWidth
PdmWidthMM
activated activated(self, int) [signal]
currentIndexChanged currentIndexChanged(self, int) [signal]
currentTextChanged currentTextChanged(self, str) [signal]
customContextMenuRequested customContextMenuRequested(self, QPoint) [signal]
destroyed destroyed(self, QObject = None) [signal]
editTextChanged editTextChanged(self, str) [signal]
highlighted highlighted(self, int) [signal]
layerChanged layerChanged this signal is emitted whenever the currently selected layer changes [signal]
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
windowIconChanged windowIconChanged(self, QIcon) [signal]
windowIconTextChanged windowIconTextChanged(self, str) [signal]
windowTitleChanged windowTitleChanged(self, str) [signal]
actionEvent()
additionalItems(self) → List[str]

Return the list of additional (non map layer) items included at the end of the combo box.

New in version 3.0.

allowEmptyLayer(self) → bool

Returns true if the combo box allows the empty layer (“not set”) choice.

New in version 3.0.

changeEvent()
childEvent()
closeEvent()
connectNotify()
contextMenuEvent()
create()
currentLayer(self) → QgsMapLayer

Returns the current layer selected in the combo box.

See also

layer()

customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
exceptedLayerList(self) → List[QgsMapLayer]

returns the list of excepted layers

excludedProviders(self) → List[str]

Returns the list of data providers which are excluded from the combobox.

New in version 3.0.

filters(self) → QgsMapLayerProxyModel.Filters

currently used filter on list layers

focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
indexChanged(self, i: int)
initPainter()
initStyleOption()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
layer(self, layerIndex: int) → QgsMapLayer

Return the layer currently shown at the specified index within the combo box.

Parameters:layerIndex – position of layer to return

New in version 2.10.

See also

currentLayer()

layerChanged

layerChanged this signal is emitted whenever the currently selected layer changes [signal]

leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent()
receivers()
resizeEvent()
rowsChanged(self)
sender()
senderSignalIndex()
setAdditionalItems(self, items: Iterable[str])

Sets a list of additional (non map layer) items to include at the end of the combobox. These may represent additional layers such as layers which are not included in the map layer registry, or paths to layers which have not yet been loaded into QGIS.

New in version 3.0.

setAllowEmptyLayer(self, allowEmpty: bool)

Sets whether an optional empty layer (“not set”) option is shown in the combo box.

New in version 3.0.

setExceptedLayerList(self, layerList: Iterable[QgsMapLayer])

except a list of layers not to be listed

setExcludedProviders(self, providers: Iterable[str])

Sets a list of data providers which should be excluded from the combobox.

New in version 3.0.

setFilters(self, filters: Union[QgsMapLayerProxyModel.Filters, QgsMapLayerProxyModel.Filter])

setFilters allows fitering according to layer type and/or geometry type.

setLayer(self, layer: QgsMapLayer)

setLayer set the current layer selected in the combo

setShowCrs(self, showCrs: bool)

Sets whether the CRS of layers is also included in the combo box text.

See also

showCrs()

New in version 3.0.

sharedPainter()
showCrs(self) → bool

Returns true if the combo box shows the layer’s CRS.

See also

setShowCrs()

New in version 3.0.

showEvent()
tabletEvent()
timerEvent()
updateMicroFocus()
wheelEvent()