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

Methods

dialogTitle

Returns the title for the symbol settings dialog window.

messageBar

Returns the message bar associated with the widget.

setDialogTitle

Sets the title for the symbol settings dialog window.

setMessageBar

Sets the message bar associated with the widget.

setPreviewSymbol

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

setShape

Sets the shape for the button.

setSymbolType

Sets the symbol type which the button requires.

setToDefault

Resets the shape to the default shape.

shape

Returns the current shape defined by the button.

symbolType

Returns the symbol type which the button requires.

Signals

changed

Emitted when the shape's settings are changed.

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]

Emitted when the shape’s settings are changed.

See also

shape()

See also

setShape()

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