Class: QgsAlignmentComboBox

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

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.

Added in version 3.10.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsAlignmentComboBox

Base classes

QComboBox

QWidget

QObject

QPaintDevice

class qgis.gui.QgsAlignmentComboBox[source]

Bases: QComboBox

__init__(parent: QWidget | None = None)

Constructor for QgsAlignmentComboBox, with the specified parent widget.

Parameters:

parent (Optional[QWidget] = None)

signal changed[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

currentAlignment(self) Qt.Alignment[source]

Returns the current alignment choice.

Return type:

Qt.Alignment

customizeAlignmentDisplay(self, alignment: Qt.Alignment | Qt.AlignmentFlag, text: str | None = '', icon: QIcon = QIcon())[source]

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.

Note

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

Parameters:
  • alignment (Union[Qt.Alignment, Qt.AlignmentFlag])

  • text (Optional[str] = '')

  • icon (QIcon = QIcon())

setAvailableAlignments(self, alignments: Qt.Alignment | Qt.AlignmentFlag)[source]

Sets the available alignment choices shown in the combo box.

Parameters:

alignments (Union[Qt.Alignment, Qt.AlignmentFlag])

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

Sets the current alignment choice.

Parameters:

alignment (Union[Qt.Alignment, Qt.AlignmentFlag])