Class: CharacterWidget

A widget for displaying characters available in a preset font, and allowing users to select an individual character.

CharacterWidget in a default state

CharacterWidget in a default state

Class Hierarchy

Inheritance diagram of qgis.gui.CharacterWidget

Base classes

QWidget

QObject

QPaintDevice

Methods

character

Returns the currently selected character in the widget.

clearCharacter

Clears the currently selected character in the widget.

columns

Returns the number of columns of characters shown in the widget.

font

Returns the font shown in the widget

setCharacter

Sets the currently selected character in the widget.

setColumns

Sets the number of columns of characters to show in the widget.

setFont

Sets the font to show in the widget.

setFontSize

Sets the font size (in points) to render in the widget.

setFontStyle

Sets the font style to show in the widget.

squareSize

Returns the size (in pixels) of the square used to render each character preview.

updateFontMerging

Signals

characterSelected

Emitted when a character is selected in the widget.

class qgis.gui.CharacterWidget[source]

Bases: QWidget

__init__(parent: QWidget | None = None)

Constructor for CharacterWidget.

Parameters:

parent (Optional[QWidget] = None)

character(self) str[source]

Returns the currently selected character in the widget.

See also

setCharacter()

Return type:

str

signal characterSelected(character: QChar)[source]

Emitted when a character is selected in the widget.

Parameters:

character (QChar)

clearCharacter(self)[source]

Clears the currently selected character in the widget.

See also

character()

See also

setCharacter()

columns(self) int[source]

Returns the number of columns of characters shown in the widget.

Return type:

int

font(self) QFont[source]

Returns the font shown in the widget

See also

setFont()

Return type:

QFont

setCharacter(self, character: str)[source]

Sets the currently selected character in the widget.

See also

character()

Parameters:

character (str)

setColumns(self, columns: int)[source]

Sets the number of columns of characters to show in the widget.

Parameters:

columns (int)

setFont(self, font: QFont)[source]

Sets the font to show in the widget.

See also

font()

Parameters:

font (QFont)

setFontSize(self, fontSize: float)[source]

Sets the font size (in points) to render in the widget.

Parameters:

fontSize (float)

setFontStyle(self, fontStyle: str | None)[source]

Sets the font style to show in the widget.

Parameters:

fontStyle (Optional[str])

squareSize(self) int[source]

Returns the size (in pixels) of the square used to render each character preview.

Return type:

int

updateFontMerging(self, enable: bool)[source]
Parameters:

enable (bool)