Class: QgsLegendPatchShapeButton

A button for creating and modifying QgsLegendPatchShape settings.

Added in version 3.14.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsLegendPatchShapeButton

Base classes

QToolButton

QAbstractButton

QWidget

QObject

QPaintDevice

class qgis.gui.QgsLegendPatchShapeButton[source]

Bases: QToolButton

__init__(parent: QWidget | None = None, dialogTitle: str | None = '')

Construct a new patch shape button with the specified parent widget. Use dialogTitle string to define the title to show in the legend patch shape widget.

Parameters:
  • parent (Optional[QWidget] = None)

  • dialogTitle (Optional[str] = '')

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.

dialogTitle(self) str[source]

Returns the title for the symbol settings dialog window.

See also

setDialogTitle()

Return type:

str

messageBar(self) QgsMessageBar | None[source]

Returns the message bar associated with the widget.

See also

setMessageBar()

Added in version 3.6.

Return type:

Optional[QgsMessageBar]

setDialogTitle(self, title: str | None)[source]

Sets the title for the symbol settings dialog window.

See also

dialogTitle()

Parameters:

title (Optional[str])

setMessageBar(self, bar: QgsMessageBar | None)[source]

Sets the message bar associated with the widget. This allows the widget to push feedback messages to the appropriate message bar.

See also

messageBar()

Added in version 3.6.

Parameters:

bar (Optional[QgsMessageBar])

setPreviewSymbol(self, symbol: QgsSymbol | None)[source]

Sets the symbol to use for previewing the legend patch shape.

Ownership is transferred to the button. It is the caller’s responsibility to ensure that the symbol type matches the button’s symbolType()

Parameters:

symbol (Optional[QgsSymbol])

setShape(self, shape: QgsLegendPatchShape)[source]

Sets the shape for the button.

See also

shape()

See also

changed()

Parameters:

shape (QgsLegendPatchShape)

setSymbolType(self, type: Qgis.SymbolType)[source]

Sets the symbol type which the button requires. If the type differs from the current symbol type, the symbol will be reset to a default symbol style of the new type.

See also

symbolType()

Parameters:

type (Qgis.SymbolType)

setToDefault(self)[source]

Resets the shape to the default shape.

shape(self) QgsLegendPatchShape[source]

Returns the current shape defined by the button.

See also

setShape()

See also

changed()

Return type:

QgsLegendPatchShape

symbolType(self) Qgis.SymbolType[source]

Returns the symbol type which the button requires.

See also

setSymbolType()

Return type:

Qgis.SymbolType