Class: QgsAlignmentComboBox

class qgis.gui.QgsAlignmentComboBox(parent: QWidget = None)

Bases: PyQt5.QtWidgets.QComboBox

Constructor for QgsAlignmentComboBox, with the specified parent widget.

A combo box which allows choice of alignment settings (e.g. left, right, …).

Currently only horizontal alignments are supported. Available alignment choices can be manually specified by calling setAvailableAlignments(), which is useful when only a subset of Qt’s alignment options should be exposed.

New in version 3.10.



actionEvent(self, QActionEvent)
changeEvent(self, QEvent)

Emitted when the alignment is changed. [signal]

childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
currentAlignment(self) → Qt.Alignment

Returns the current alignment choice.

Return type


customEvent(self, QEvent)
customizeAlignmentDisplay(self, alignment: Union[Qt.Alignment, Qt.AlignmentFlag], text: str = '', icon: QIcon = QIcon())

Sets the text and icon to use for a particular alignment option, replacing the default text or icon.

If text or icon is not specified, they will not be changed from the default.


This must be called after first filtering the available alignment options via setAvailableAlignments().

  • alignment (Union[Qt.Alignment) –

  • text (str = '') –

  • icon (QIcon = QIcon()) –

destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
focusInEvent(self, QFocusEvent)
focusNextChild(self) → bool
focusNextPrevChild(self, bool) → bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) → bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionComboBox)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) → bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) → int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) → Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) → int
resizeEvent(self, QResizeEvent)
sender(self) → QObject
senderSignalIndex(self) → int
setAvailableAlignments(self, alignments: Union[Qt.Alignment, Qt.AlignmentFlag])

Sets the available alignment choices shown in the combo box.


alignments (Union[Qt.Alignment) –

setCurrentAlignment(self, alignment: Union[Qt.Alignment, Qt.AlignmentFlag])

Sets the current alignment choice.


alignment (Union[Qt.Alignment) –

sharedPainter(self) → QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
wheelEvent(self, QWheelEvent)