Skip to content

TextBlockFormat

Qt Base Class: QTextBlockFormat

Signature: QTextBlockFormat(self) -> None QTextBlockFormat(self, QTextBlockFormat: PySide6.QtGui.QTextBlockFormat) -> None QTextBlockFormat(self, fmt: PySide6.QtGui.QTextFormat) -> None

Base classes

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

⋔ Inheritance diagram

graph TD
  1473245649008["gui.TextBlockFormat"]
  1473245646080["gui.TextFormatMixin"]
  140713234304496["builtins.object"]
  1473300003312["QtGui.QTextBlockFormat"]
  1473299700832["QtGui.QTextFormat"]
  1473291690208["Shiboken.Object"]
  1473245646080 --> 1473245649008
  140713234304496 --> 1473245646080
  1473300003312 --> 1473245649008
  1473299700832 --> 1473300003312
  1473291690208 --> 1473299700832
  140713234304496 --> 1473291690208

🛈 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))