Skip to content

StaticText

Qt Base Class: QStaticText

Signature: QStaticText(self) -> None QStaticText(self, other: PySide6.QtGui.QStaticText) -> None QStaticText(self, text: str) -> None

Base classes

Name Children Inherits
QStaticText
PySide6.QtGui
QStaticText(self) -> None

⋔ Inheritance diagram

graph TD
  1473245581664["gui.StaticText"]
  1473300164352["QtGui.QStaticText"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473300164352 --> 1473245581664
  1473291690208 --> 1473300164352
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QStaticText

Source code in prettyqt\gui\statictext.py
class StaticText(QtGui.QStaticText):
    def __repr__(self):
        return get_repr(self, self.text())

    def __str__(self):
        return self.text()

    def get_size(self) -> core.SizeF:
        return core.SizeF(self.size())

    def set_text_format(
        self, text_format: constants.TextFormatStr | constants.TextFormat
    ):
        """Set the text format.

        Allowed values are "rich", "plain", "auto", "markdown"

        Args:
            text_format: text format to use
        """
        self.setTextFormat(constants.TEXT_FORMAT.get_enum_value(text_format))

    def get_text_format(self) -> constants.TextFormatStr:
        """Return current text format.

        Possible values: "rich", "plain", "auto", "markdown"

        Returns:
            text format
        """
        return constants.TEXT_FORMAT.inverse[self.textFormat()]

    def set_performance_hint(
        self, hint: PerformanceHintStr | QtGui.QStaticText.PerformanceHint
    ):
        """Set the performance hint.

        Args:
            hint: performance hint to use
        """
        self.setPerformanceHint(PERFORMANCE_HINT.get_enum_value(hint))

    def get_performance_hint(self) -> PerformanceHintStr:
        """Return current performance hint.

        Returns:
            performance hint
        """
        return PERFORMANCE_HINT.inverse[self.performanceHint()]

get_performance_hint() -> PerformanceHintStr

Return current performance hint.

Source code in prettyqt\gui\statictext.py
def get_performance_hint(self) -> PerformanceHintStr:
    """Return current performance hint.

    Returns:
        performance hint
    """
    return PERFORMANCE_HINT.inverse[self.performanceHint()]

get_text_format() -> constants.TextFormatStr

Return current text format.

Possible values: "rich", "plain", "auto", "markdown"

Source code in prettyqt\gui\statictext.py
def get_text_format(self) -> constants.TextFormatStr:
    """Return current text format.

    Possible values: "rich", "plain", "auto", "markdown"

    Returns:
        text format
    """
    return constants.TEXT_FORMAT.inverse[self.textFormat()]

set_performance_hint(hint: PerformanceHintStr | QtGui.QStaticText.PerformanceHint)

Set the performance hint.

Parameters:

Name Type Description Default
hint PerformanceHintStr | PerformanceHint

performance hint to use

required
Source code in prettyqt\gui\statictext.py
def set_performance_hint(
    self, hint: PerformanceHintStr | QtGui.QStaticText.PerformanceHint
):
    """Set the performance hint.

    Args:
        hint: performance hint to use
    """
    self.setPerformanceHint(PERFORMANCE_HINT.get_enum_value(hint))

set_text_format(text_format: constants.TextFormatStr | constants.TextFormat)

Set the text format.

Allowed values are "rich", "plain", "auto", "markdown"

Parameters:

Name Type Description Default
text_format TextFormatStr | TextFormat

text format to use

required
Source code in prettyqt\gui\statictext.py
def set_text_format(
    self, text_format: constants.TextFormatStr | constants.TextFormat
):
    """Set the text format.

    Allowed values are "rich", "plain", "auto", "markdown"

    Args:
        text_format: text format to use
    """
    self.setTextFormat(constants.TEXT_FORMAT.get_enum_value(text_format))