Home · All Classes · Modules

QTextOption Class Reference
[QtGui module]

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

Types

Methods


Detailed Description

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

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.

See also QTextEdit, QTextDocument, and QTextCursor.


Type Documentation

QTextOption.Flag

ConstantValueDescription
QTextOption.IncludeTrailingSpaces0x80000000When 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.ShowTabsAndSpaces0x1Visualize spaces with little dots, and tabs with little arrows.
QTextOption.ShowLineAndParagraphSeparators0x2Visualize line and paragraph separators with appropriate symbol characters.
QTextOption.AddSpaceForLineAndParagraphSeparators0x4While determining the line-break positions take into account the space added for drawing a separator character.
QTextOption.SuppressColors0x8Suppress all color changes in the character formats (except the main selection).

The Flags type is a typedef for QFlags<Flag>. It stores an OR combination of Flag values.

QTextOption.TabType

This enum holds the different types of tabulator

ConstantValueDescription
QTextOption.LeftTab0A left-tab
QTextOption.RightTab1A right-tab
QTextOption.CenterTab2A centered-tab
QTextOption.DelimiterTab3A tab stopping at a certain delimiter-character

This enum was introduced in Qt 4.4.

QTextOption.WrapMode

This enum describes how text is wrapped in a document.

ConstantValueDescription
QTextOption.NoWrap0Text is not wrapped at all.
QTextOption.WordWrap1Text is wrapped at word boundaries.
QTextOption.ManualWrap2Same as QTextOption.NoWrap
QTextOption.WrapAnywhere3Text can be wrapped at any point on a line, even if it occurs in the middle of a word.
QTextOption.WrapAtWordBoundaryOrAnywhere4If 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.


Method Documentation

QTextOption.__init__ (self)

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.

QTextOption.__init__ (self, Qt.Alignment)

Constructs a text option with the given alignment for text. The word wrap property is set to QTextOption.WordWrap. The using of design metrics flag is set to false.

QTextOption.__init__ (self, QTextOption)

Construct a copy of the other text option.

Qt.Alignment QTextOption.alignment (self)

Returns the text alignment defined by the option.

See also setAlignment().

Flags QTextOption.flags (self)

Returns the flags associated with the option.

See also setFlags().

QTextOption.setAlignment (self, Qt.Alignment)

Sets the option's text alignment to the specified alignment.

See also alignment().

QTextOption.setFlags (self, Flags)

Sets the flags associated with the option to the given flags.

See also flags().

QTextOption.setTabArray (self, list-of-float)

Sets the tab positions for the text layout to those specified by tabStops.

See also tabArray(), setTabStop(), and setTabs().

QTextOption.setTabs (self, list-of-QTextOption.Tab)

Set the Tab properties to tabStops.

See also tabStop() and tabs().

QTextOption.setTabStop (self, float)

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

See also tabStop(), setTabArray(), setTabs(), and tabs().

QTextOption.setTextDirection (self, Qt.LayoutDirection)

Sets the direction of the text layout defined by the option to the given direction.

See also textDirection().

QTextOption.setUseDesignMetrics (self, 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).

See also useDesignMetrics().

QTextOption.setWrapMode (self, WrapMode)

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

See also wrapMode().

list-of-float QTextOption.tabArray (self)

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

See also setTabArray() and tabStop().

list-of-QTextOption.Tab QTextOption.tabs (self)

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

This function was introduced in Qt 4.4.

See also tabStop(), setTabs(), and setTabStop().

float QTextOption.tabStop (self)

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

See also setTabStop(), tabArray(), setTabs(), and tabs().

Qt.LayoutDirection QTextOption.textDirection (self)

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

See also setTextDirection().

bool QTextOption.useDesignMetrics (self)

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

See also setUseDesignMetrics().

WrapMode QTextOption.wrapMode (self)

Returns the text wrap mode defined by the option.

See also setWrapMode().


PyQt 4.7.3 for X11Copyright © Riverbank Computing Ltd and Nokia 2010Qt 4.6.2