内容表

上一话题

QTextObjectInterface

下一话题

QTextTable

QTextOption

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

Inheritance diagram of PySide2.QtGui.QTextOption

概要

函数

详细描述

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 QTextOption

QTextOption(alignment)

QTextOption(o)

param o

QTextOption

param alignment

Alignment

Constructs a text option with default properties for text. The text alignment property is set to AlignLeft . The word wrap property is set to WordWrap 。设计指标所用标志被设为 false。

构造文本选项采用给定 alignment 为文本。单词换行特性被设为 WordWrap 。设计指标所用标志被设为 false。

PySide2.QtGui.QTextOption. TabType

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

常量

描述

QTextOption.LeftTab

左 Tab

QTextOption.RightTab

右 Tab

QTextOption.CenterTab

居中 Tab

QTextOption.DelimiterTab

停在某个定界符处的 Tab

PySide2.QtGui.QTextOption. WrapMode

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

常量

描述

QTextOption.NoWrap

文本根本不换行。

QTextOption.WordWrap

文本在单词边界处换行。

QTextOption.ManualWrap

如同

QTextOption.WrapAnywhere

文本可以在行的任何位置处换行,即使出现在单词中间。

QTextOption.WrapAtWordBoundaryOrAnywhere

若可能,在单词边界处换行;否则,换行将出现在行的适当位置处,甚至在单词中间。

PySide2.QtGui.QTextOption. Flag

常量

描述

QTextOption.IncludeTrailingSpaces

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. This enum value was added in Qt 5.7.

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

PySide2.QtGui.QTextOption. alignment ( )
返回类型

Alignment

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

另请参阅

setAlignment()

PySide2.QtGui.QTextOption. flags ( )
返回类型

标志

返回与选项关联的标志。

另请参阅

setFlags()

PySide2.QtGui.QTextOption. setAlignment ( alignment )
参数

alignment Alignment

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

另请参阅

alignment()

PySide2.QtGui.QTextOption. setFlags ( flags )
参数

flags 标志

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

另请参阅

flags()

PySide2.QtGui.QTextOption. setTabArray ( tabStops )
参数

tabStops

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

PySide2.QtGui.QTextOption. setTabStop ( tabStop )
参数

tabStop qreal

注意

此函数被弃用。

in Qt 5.10. Use setTabStopDistance() 代替。

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

PySide2.QtGui.QTextOption. setTabStopDistance ( tabStopDistance )
参数

tabStopDistance qreal

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

PySide2.QtGui.QTextOption. setTabs ( tabStops )
参数

tabStops

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

PySide2.QtGui.QTextOption. setTextDirection ( aDirection )
参数

aDirection LayoutDirection

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

另请参阅

textDirection()

PySide2.QtGui.QTextOption. setUseDesignMetrics ( b )
参数

b bool

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

PySide2.QtGui.QTextOption. setWrapMode ( wrap )
参数

wrap WrapMode

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

另请参阅

wrapMode()

PySide2.QtGui.QTextOption. tabArray ( )
返回类型

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

PySide2.QtGui.QTextOption. tabStop ( )
返回类型

qreal

注意

此函数被弃用。

in Qt 5.10. Use tabStopDistance() 代替。

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

PySide2.QtGui.QTextOption. tabStopDistance ( )
返回类型

qreal

Returns the distance in device units between tab stops.

PySide2.QtGui.QTextOption. tabs ( )
返回类型

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

PySide2.QtGui.QTextOption. textDirection ( )
返回类型

LayoutDirection

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

PySide2.QtGui.QTextOption. useDesignMetrics ( )
返回类型

bool

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

PySide2.QtGui.QTextOption. wrapMode ( )
返回类型

WrapMode

Returns the text wrap mode defined by the option.

另请参阅

setWrapMode()