Skip to content

TextBlockFormat

Base classes

Name Children Inherits
TextFormatMixin
prettyqt.gui.textformat
QTextBlockFormat
PySide6.QtGui
QTextBlockFormat(self, /) -> None

â‹” Inheritance diagram

graph TD
  1629978904["gui.TextBlockFormat"]
  1171567019["gui.TextFormatMixin"]
  2751680898["builtins.object"]
  3612232359["QtGui.QTextBlockFormat"]
  1757385971["QtGui.QTextFormat"]
  37984305["Shiboken.Object"]
  1171567019 --> 1629978904
  2751680898 --> 1171567019
  3612232359 --> 1629978904
  1757385971 --> 3612232359
  37984305 --> 1757385971
  2751680898 --> 37984305

🛈 DocStrings

Bases: TextFormatMixin, QTextBlockFormat

Source code in prettyqt/gui/textblockformat.py
class TextBlockFormat(gui.TextFormatMixin, gui.QTextBlockFormat):
    def set_marker(self, marker: MarkerTypeStr | gui.QTextBlockFormat.MarkerType):
        """Set the marker.

        Args:
            marker: marker
        """
        self.setMarker(MARKER_TYPE.get_enum_value(marker))

    def get_marker(self) -> MarkerTypeStr:
        """Get current marker.

        Returns:
            current marker
        """
        return MARKER_TYPE.inverse[self.marker()]

    def set_alignment(self, alignment: constants.AlignmentStr | constants.AlignmentFlag):
        """Set the alignment of the format.

        Args:
            alignment: alignment for the format
        """
        self.setAlignment(constants.ALIGNMENTS.get_enum_value(alignment))

    def get_alignment(self) -> constants.AlignmentStr:
        """Return current alignment.

        Returns:
            alignment
        """
        return constants.ALIGNMENTS.inverse[self.alignment()]

    def set_page_break_policy(
        self, policy: gui.textformat.PageBreakFlagStr | gui.QTextFormat.PageBreakFlag
    ):
        """Set page break policy.

        Args:
            policy: page break policy
        """
        self.setPageBreakPolicy(gui.textformat.PAGE_BREAK_FLAG.get_enum_value(policy))

    def get_page_break_policy(self) -> gui.textformat.PageBreakFlagStr:
        """Get the current page break policy.

        Returns:
            page break policy
        """
        return gui.textformat.PAGE_BREAK_FLAG.inverse[self.pageBreakPolicy()]

get_alignment() -> constants.AlignmentStr

Return current alignment.

Source code in prettyqt/gui/textblockformat.py
def get_alignment(self) -> constants.AlignmentStr:
    """Return current alignment.

    Returns:
        alignment
    """
    return constants.ALIGNMENTS.inverse[self.alignment()]

get_marker() -> MarkerTypeStr

Get current marker.

Source code in prettyqt/gui/textblockformat.py
def get_marker(self) -> MarkerTypeStr:
    """Get current marker.

    Returns:
        current marker
    """
    return MARKER_TYPE.inverse[self.marker()]

get_page_break_policy() -> gui.textformat.PageBreakFlagStr

Get the current page break policy.

Source code in prettyqt/gui/textblockformat.py
def get_page_break_policy(self) -> gui.textformat.PageBreakFlagStr:
    """Get the current page break policy.

    Returns:
        page break policy
    """
    return gui.textformat.PAGE_BREAK_FLAG.inverse[self.pageBreakPolicy()]

set_alignment(alignment: constants.AlignmentStr | constants.AlignmentFlag)

Set the alignment of the format.

Parameters:

Name Type Description Default
alignment AlignmentStr | AlignmentFlag

alignment for the format

required
Source code in prettyqt/gui/textblockformat.py
def set_alignment(self, alignment: constants.AlignmentStr | constants.AlignmentFlag):
    """Set the alignment of the format.

    Args:
        alignment: alignment for the format
    """
    self.setAlignment(constants.ALIGNMENTS.get_enum_value(alignment))

set_marker(marker: MarkerTypeStr | gui.QTextBlockFormat.MarkerType)

Set the marker.

Parameters:

Name Type Description Default
marker MarkerTypeStr | MarkerType

marker

required
Source code in prettyqt/gui/textblockformat.py
def set_marker(self, marker: MarkerTypeStr | gui.QTextBlockFormat.MarkerType):
    """Set the marker.

    Args:
        marker: marker
    """
    self.setMarker(MARKER_TYPE.get_enum_value(marker))

set_page_break_policy(policy: gui.textformat.PageBreakFlagStr | gui.QTextFormat.PageBreakFlag)

Set page break policy.

Parameters:

Name Type Description Default
policy PageBreakFlagStr | PageBreakFlag

page break policy

required
Source code in prettyqt/gui/textblockformat.py
def set_page_break_policy(
    self, policy: gui.textformat.PageBreakFlagStr | gui.QTextFormat.PageBreakFlag
):
    """Set page break policy.

    Args:
        policy: page break policy
    """
    self.setPageBreakPolicy(gui.textformat.PAGE_BREAK_FLAG.get_enum_value(policy))

:fa-brands-github: Show source on GitHub