QTextOptionclass provides a description of general rich text properties. 更多 …
def
alignment
()
def
flags
()
def
setAlignment
(alignment)
def
setFlags
(flags)
def
setTabArray
(tabStops)
def
setTabStop
(tabStop)
def
setTabStopDistance
(tabStopDistance)
def
setTabs
(tabStops)
def
setTextDirection
(aDirection)
def
setUseDesignMetrics
(b)
def
setWrapMode
(wrap)
def
tabArray
()
def
tabStop
()
def
tabStopDistance
()
def
tabs
()
def
textDirection
()
def
useDesignMetrics
()
def
wrapMode
()
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.
QTextOption
¶
QTextOption(alignment)
QTextOption(o)
- param o
- 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,
|
|
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
返回由选项定义的文本对齐方式。
另请参阅
PySide2.QtGui.QTextOption.
flags
(
)
¶
标志
返回与选项关联的标志。
另请参阅
PySide2.QtGui.QTextOption.
setAlignment
(
alignment
)
¶
alignment
–
Alignment
Sets the option’s text alignment to the specified
alignment
.
另请参阅
PySide2.QtGui.QTextOption.
setFlags
(
flags
)
¶
flags
–
标志
Sets the flags associated with the option to the given
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
.
另请参阅
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
.
另请参阅
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
(
)
¶
Returns the text wrap mode defined by the option.
另请参阅