auto_wrap ========= .. py:module:: qfluentwidgets.common.auto_wrap Module Contents --------------- .. autoapisummary:: qfluentwidgets.common.auto_wrap.CharType qfluentwidgets.common.auto_wrap.TextWrap .. py:class:: CharType Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: SPACE .. py:attribute:: ASIAN .. py:attribute:: LATIN .. py:class:: TextWrap Text wrap .. py:attribute:: EAST_ASAIN_WIDTH_TABLE .. py:method:: get_width(char: str) -> int :classmethod: Returns the width of the char .. py:method:: get_text_width(text: str) -> int :classmethod: Returns the width of the text .. py:method:: get_char_type(char: str) -> CharType :classmethod: Returns the type of the char .. py:method:: process_text_whitespace(text: str) -> str :classmethod: Process whitespace and leading and trailing spaces in strings .. py:method:: split_long_token(token: str, width: int) -> List[str] :classmethod: Split long token into smaller chunks. .. py:method:: tokenizer(text: str) :classmethod: tokenize line .. py:method:: wrap(text: str, width: int, once: bool = True) -> Tuple[str, bool] :classmethod: Wrap according to string length Parameters ---------- text: str the text to be wrapped width: int the maximum length of a single line, the length of Chinese characters is 2 once: bool whether to wrap only once Returns ------- wrap_text: str text after auto word wrap process is_wrapped: bool whether a line break occurs in the text