QTextOption Class Reference

[ QtGui module]

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

类型

方法


详细描述

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.


类型文档编制

QTextOption.Flag

常量 描述
QTextOption.IncludeTrailingSpaces 0x80000000 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 0x1 Visualize spaces with little dots, and tabs with little arrows.
QTextOption.ShowLineAndParagraphSeparators 0x2 Visualize line and paragraph separators with appropriate symbol characters.
QTextOption.AddSpaceForLineAndParagraphSeparators 0x4 While determining the line-break positions take into account the space added for drawing a separator character.
QTextOption.SuppressColors 0x8 Suppress all color changes in the character formats (except the main selection).

Flags 类型是 typedef 对于 QFlags <Flag>. It stores an OR combination of Flag values.

QTextOption.TabType

此枚举包含不同类型的制表符

常量 描述
QTextOption.LeftTab 0 左 Tab
QTextOption.RightTab 1 右 Tab
QTextOption.CenterTab 2 居中 Tab
QTextOption.DelimiterTab 3 A tab stopping at a certain delimiter-character

该枚举在 Qt 4.4 引入或被修改。

QTextOption.WrapMode

此枚举描述文本如何在文档中换行。

常量 描述
QTextOption.NoWrap 0 文本根本不换行。
QTextOption.WordWrap 1 文本在单词边界处换行。
QTextOption.ManualWrap 2 Same as QTextOption.NoWrap
QTextOption.WrapAnywhere 3 Text can be wrapped at any point on a line, even if it occurs in the middle of a word.
QTextOption.WrapAtWordBoundaryOrAnywhere 4 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.

方法文档编制

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

QTextOption.__init__ ( self , Qt.Alignment   alignment )

构造文本选项采用给定 alignment for text. The word wrap property is set to QTextOption.WordWrap 。 using of design metrics flag is set to false.

QTextOption.__init__ ( self , QTextOption   o )

构造副本为 other 文本选项。

Qt.Alignment QTextOption.alignment ( self )

返回由选项定义的文本对齐方式。

另请参阅 setAlignment ().

Flags QTextOption.flags ( self )

返回与选项关联的标志。

另请参阅 setFlags ().

QTextOption.setAlignment ( self , Qt.Alignment   aalignment )

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

另请参阅 alignment ().

QTextOption.setFlags ( self , Flags   aflags )

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

另请参阅 flags ().

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

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

另请参阅 tabArray (), setTabStop (),和 setTabs ().

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

Set the Tab properties to tabStops .

另请参阅 tabStop () and tabs ().

QTextOption.setTabStop ( self , float  atabStop )

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

另请参阅 tabStop (), setTabArray (), setTabs (),和 tabs ().

QTextOption.setTextDirection ( self , Qt.LayoutDirection   aDirection )

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

另请参阅 textDirection ().

QTextOption.setUseDesignMetrics ( self , bool  b )

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

另请参阅 useDesignMetrics ().

QTextOption.setWrapMode ( self , WrapMode   wrap )

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

另请参阅 wrapMode ().

list-of-float QTextOption.tabArray ( self )

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

另请参阅 setTabArray () 和 tabStop ().

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

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

该函数在 Qt 4.4 引入。

另请参阅 tabStop (), setTabs (),和 setTabStop ().

float QTextOption.tabStop ( self )

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

另请参阅 setTabStop (), tabArray (), setTabs (),和 tabs ().

Qt.LayoutDirection QTextOption.textDirection ( self )

Returns the direction of the text layout defined by the 选项。

另请参阅 setTextDirection ().

bool QTextOption.useDesignMetrics ( self )

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

另请参阅 setUseDesignMetrics ().

WrapMode QTextOption.wrapMode ( self )

Returns the text wrap mode defined by the option.

另请参阅 setWrapMode ().