PySide6.QtGui.QTextOption¶
- class QTextOption¶
The
QTextOptionclass provides a description of general rich text properties. More_…Synopsis¶
Methods¶
def
__init__()def
alignment()def
flags()def
setAlignment()def
setFlags()def
setTabArray()def
setTabs()def
setWrapMode()def
tabArray()def
tabs()def
textDirection()def
wrapMode()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
QTextOptionis used to encapsulate common rich text properties in a single object. It contains information about text alignment, layout direction, word wrapping, and other standard properties associated with text rendering and layout.See also
- class TabType¶
This enum holds the different types of tabulator
Constant
Description
QTextOption.LeftTab
A left-tab
QTextOption.RightTab
A right-tab
QTextOption.CenterTab
A centered-tab
QTextOption.DelimiterTab
A tab stopping at a certain delimiter-character
- class WrapMode¶
This enum describes how text is wrapped in a document.
Constant
Description
QTextOption.NoWrap
Text is not wrapped at all.
QTextOption.WordWrap
Text is wrapped at word boundaries.
QTextOption.ManualWrap
Same as QTextOption::NoWrap
QTextOption.WrapAnywhere
Text can be wrapped at any point on a line, even if it occurs in the middle of a word.
QTextOption.WrapAtWordBoundaryOrAnywhere
If possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.
- class Flag¶
Constant
Description
QTextOption.IncludeTrailingSpaces
(inherits
enum.Flag) When this option is set,naturalTextWidth()and naturalTextRect() will return a value that includes the width of trailing spaces in the text; otherwise this width is excluded.QTextOption.ShowTabsAndSpaces
Visualize spaces with little dots, and tabs with little arrows. Non-breaking spaces are shown differently to breaking spaces.
QTextOption.ShowLineAndParagraphSeparators
Visualize line and paragraph separators with appropriate symbol characters.
QTextOption.ShowDocumentTerminator
Visualize the end of the document with a section sign.
QTextOption.AddSpaceForLineAndParagraphSeparators
While determining the line-break positions take into account the space added for drawing a separator character.
QTextOption.SuppressColors
Suppress all color changes in the character formats (except the main selection).
- __init__()¶
Constructs a text option with default properties for text. The text alignment property is set to Qt::AlignLeft. The word wrap property is set to
WordWrap. The using of design metrics flag is set to false.- __init__(alignment)
- Parameters:
alignment – Combination of
AlignmentFlag
Constructs a text option with the given
alignmentfor text. The word wrap property is set toWordWrap. The using of design metrics flag is set to false.- __init__(o)
- Parameters:
o –
QTextOption
Construct a copy of the
othertext option.- alignment()¶
- Return type:
Combination of
AlignmentFlag
Returns the text alignment defined by the option.
See also
Returns the flags associated with the option.
See also
- setAlignment(alignment)¶
- Parameters:
alignment – Combination of
AlignmentFlag
Sets the option’s text alignment to the specified
alignment.See also
Sets the flags associated with the option to the given
flags.See also
- setTabArray(tabStops)¶
- Parameters:
tabStops – .list of qreal
Sets the tab positions for the text layout to those specified by
tabStops.See also
- setTabStopDistance(tabStopDistance)¶
- Parameters:
tabStopDistance – float
Sets the default distance in device units between tab stops to the value specified by
tabStopDistance.See also
- setTabs(tabStops)¶
- Parameters:
tabStops – .list of QTextOption.Tab
Sets the tab positions for the text layout to those specified by
tabStops.See also
- setTextDirection(aDirection)¶
- Parameters:
aDirection –
LayoutDirection
Sets the direction of the text layout defined by the option to the given
direction.See also
- setUseDesignMetrics(b)¶
- Parameters:
b – bool
If
enableis true then the layout will use design metrics; otherwise it will use the metrics of the paint device (which is the default behavior).See also
Sets the option’s text wrap mode to the given
mode.See also
- tabArray()¶
- Return type:
.list of qreal
Returns a list of tab positions defined for the text layout.
See also
- tabStopDistance()¶
- Return type:
float
Returns the distance in device units between tab stops.
See also
- tabs()¶
- Return type:
.list of QTextOption.Tab
Returns a list of tab positions defined for the text layout.
- textDirection()¶
- Return type:
Returns the direction of the text layout defined by the option.
See also
- useDesignMetrics()¶
- Return type:
bool
Returns
trueif the layout uses design rather than device metrics; otherwise returnsfalse.See also
Returns the text wrap mode defined by the option.
See also
- class Tab¶
Synopsis¶
Methods¶
def
__init__()def
__ne__()def
__eq__()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
- PySide6.QtGui.QTextOption.Tab.position¶
- PySide6.QtGui.QTextOption.Tab.type¶
- PySide6.QtGui.QTextOption.Tab.delimiter¶
- __init__()¶
Creates a default left tab with position 80.
- __init__(pos, tabType[, delim=QChar()])
- Parameters:
pos – float
tabType –
TabTypedelim –
QChar
Creates a tab with the given position, tab type, and delimiter (
pos,tabType,delim).Note
delimis only used whentabTypeisDelimiterTab.Returns
trueif tabotheris not equal to this tab; otherwise returnsfalse.Returns
trueif tabotheris equal to this tab; otherwise returnsfalse.