Table Of Contents

Previous topic

QTextLength

Next topic

QTextOption.Tab

QTextOption

Synopsis

Functions

Detailed Description

The PySide.QtGui.QTextOption class provides a description of general rich text properties.

PySide.QtGui.QTextOption is 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.

class PySide.QtGui.QTextOption
class PySide.QtGui.QTextOption(alignment)
class PySide.QtGui.QTextOption(o)
Parameters:

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 QTextOption.WordWrap . The using of design metrics flag is set to false.

Construct a copy of the other text option.

PySide.QtGui.QTextOption.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
PySide.QtGui.QTextOption.Flag
Constant Description
QTextOption.IncludeTrailingSpaces When this option is set, QTextLine.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.
QTextOption.ShowLineAndParagraphSeparators Visualize line and paragraph separators with appropriate symbol characters.
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).
PySide.QtGui.QTextOption.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.
PySide.QtGui.QTextOption.alignment()
Return type:PySide.QtCore.Qt.Alignment

Returns the text alignment defined by the option.

PySide.QtGui.QTextOption.flags()
Return type:PySide.QtGui.QTextOption.Flags

Returns the flags associated with the option.

PySide.QtGui.QTextOption.setAlignment(alignment)
Parameters:alignmentPySide.QtCore.Qt.Alignment
PySide.QtGui.QTextOption.setFlags(flags)
Parameters:flagsPySide.QtGui.QTextOption.Flags
PySide.QtGui.QTextOption.setTabArray(tabStops)
Parameters:tabStops
PySide.QtGui.QTextOption.setTabStop(tabStop)
Parameters:tabStopPySide.QtCore.qreal

Sets the default distance in device units between tab stops to the value specified by tabStop .

PySide.QtGui.QTextOption.setTabs(tabStops)
Parameters:tabStops
PySide.QtGui.QTextOption.setTextDirection(aDirection)
Parameters:aDirectionPySide.QtCore.Qt.LayoutDirection
PySide.QtGui.QTextOption.setUseDesignMetrics(b)
Parameters:bPySide.QtCore.bool

If enable is true then the layout will use design metrics; otherwise it will use the metrics of the paint device (which is the default behavior).

PySide.QtGui.QTextOption.setWrapMode(wrap)
Parameters:wrapPySide.QtGui.QTextOption.WrapMode

Sets the option’s text wrap mode to the given mode .

PySide.QtGui.QTextOption.tabArray()
Return type:

Returns a list of tab positions defined for the text layout.

PySide.QtGui.QTextOption.tabStop()
Return type:PySide.QtCore.qreal

Returns the distance in device units between tab stops. Convenient function for the above method

PySide.QtGui.QTextOption.tabs()
Return type:

Returns a list of tab positions defined for the text layout.

PySide.QtGui.QTextOption.textDirection()
Return type:PySide.QtCore.Qt.LayoutDirection

Returns the direction of the text layout defined by the option.

PySide.QtGui.QTextOption.useDesignMetrics()
Return type:PySide.QtCore.bool

Returns true if the layout uses design rather than device metrics; otherwise returns false.

PySide.QtGui.QTextOption.wrapMode()
Return type:PySide.QtGui.QTextOption.WrapMode

Returns the text wrap mode defined by the option.