Skip to content

FontVariableAxis

Base classes

Name Children Inherits
QFontVariableAxis
PySide6.QtGui
QFontVariableAxis(self, axis: PySide6.QtGui.QFontVariableAxis, /, *, tag: PySide6.QtCore.QByteArray | bytes | bytearray | memoryview | None \= None, name: str | None \= None, minimumValue: float | None \= None, maximumValue: float | None \= None, defaultValue: float | None \= None) -> None

⋔ Inheritance diagram

graph TD
  1419154923["gui.FontVariableAxis"]
  2961072487["QtGui.QFontVariableAxis"]
  37984305["Shiboken.Object"]
  2751680898["builtins.object"]
  2961072487 --> 1419154923
  37984305 --> 2961072487
  2751680898 --> 37984305

🛈 DocStrings

Bases: QFontVariableAxis

Represents a variable axis in a font.

Source code in prettyqt/gui/fontvariableaxis.py
class FontVariableAxis(QtGui.QFontVariableAxis):
    """Represents a variable axis in a font."""

    def __repr__(self):
        return get_repr(
            self,
            self.name(),
            self.minimumValue(),
            self.maximumValue(),
            self.defaultValue(),
        )

    def get_tag(self) -> str:
        """Return the axis tag as a 4-character string."""
        return bytes(self.tag().toString().data()).decode()

    def set_tag(self, tag: str | QtGui.QFont.Tag):
        """Set the axis tag from a string or QFont.Tag."""
        if isinstance(tag, str):
            parsed = QtGui.QFont.Tag.fromString(tag)
            if parsed is None:
                raise ValueError(tag)
            tag = parsed
        self.setTag(tag)

get_tag() -> str

Return the axis tag as a 4-character string.

Source code in prettyqt/gui/fontvariableaxis.py
def get_tag(self) -> str:
    """Return the axis tag as a 4-character string."""
    return bytes(self.tag().toString().data()).decode()

set_tag(tag: str | QtGui.QFont.Tag)

Set the axis tag from a string or QFont.Tag.

Source code in prettyqt/gui/fontvariableaxis.py
def set_tag(self, tag: str | QtGui.QFont.Tag):
    """Set the axis tag from a string or QFont.Tag."""
    if isinstance(tag, str):
        parsed = QtGui.QFont.Tag.fromString(tag)
        if parsed is None:
            raise ValueError(tag)
        tag = parsed
    self.setTag(tag)

:fa-brands-github: Show source on GitHub