QPlainTextEdit

概要

详细描述

PySide.QtGui.QPlainTextEdit class provides a widget that is used to edit and display plain text.

介绍和概念

PySide.QtGui.QPlainTextEdit is an advanced viewer/editor supporting plain text. It is optimized to handle large documents and to respond quickly to user input.

QPlainText 使用了一样的技术和概念,如 PySide.QtGui.QTextEdit ,但为纯文本处理进行了优化。

PySide.QtGui.QPlainTextEdit works on paragraphs and characters. A paragraph is a formatted string which is word-wrapped to fit into the width of the widget. By default when reading plain text, one newline signifies a paragraph. A document consists of zero or more paragraphs. Paragraphs are separated by hard line breaks. Each character within a paragraph has its own attributes, for example, font and color.

The shape of the mouse cursor on a PySide.QtGui.QPlainTextEdit is Qt.IBeamCursor 默认情况下。它可以被改变透过 PySide.QtGui.QAbstractScrollArea.viewport() ‘s cursor property.

使用 QPlainTextEdit 作为显示 Widget

设置或替代文本使用 PySide.QtGui.QPlainTextEdit.setPlainText() which deletes the existing text and replaces it with the text passed to PySide.QtGui.QPlainTextEdit.setPlainText() .

插入文本可用使用 PySide.QtGui.QTextCursor 类或使用方便函数 PySide.QtGui.QPlainTextEdit.insertPlainText() , PySide.QtGui.QPlainTextEdit.appendPlainText() or PySide.QtGui.QPlainTextEdit.paste() .

默认情况下,文本编辑在空白处自动换行以拟合在文本编辑 Widget 内。 PySide.QtGui.QPlainTextEdit.setLineWrapMode() function is used to specify the kind of line wrap you want, WidgetWidth or NoWrap 若不想要任何换行。若使用自动换行到 Widget 的宽度 WidgetWidth ,可以指定是在空白处断开还是在任何地方断开采用 PySide.QtGui.QPlainTextEdit.setWordWrapMode() .

PySide.QtGui.QPlainTextEdit.find() function can be used to find and select a given string within the text.

If you want to limit the total number of paragraphs in a PySide.QtGui.QPlainTextEdit , as it is for example useful in a log viewer, then you can use the PySide.QtGui.QPlainTextEdit.maximumBlockCount() 特性。组合 PySide.QtGui.QPlainTextEdit.setMaximumBlockCount() and PySide.QtGui.QPlainTextEdit.appendPlainText() turns PySide.QtGui.QPlainTextEdit into an efficient viewer for log text. The scrolling can be reduced with the PySide.QtGui.QPlainTextEdit.centerOnScroll() property, making the log viewer even faster. Text can be formatted in a limited way, either using a syntax highlighter (see below), or by appending html-formatted text with PySide.QtGui.QPlainTextEdit.appendHtml() . While PySide.QtGui.QPlainTextEdit does not support complex rich text rendering with tables and floats, it does support limited paragraph-based formatting that you may need in a log viewer.

只读键绑定

PySide.QtGui.QPlainTextEdit is used read-only the key bindings are limited to navigation, and text may only be selected with the mouse:

Keypresses Action
Qt.UpArrow 向上移动一行。
Qt.DownArrow 向下移动一行。
Qt.LeftArrow 向左移动一字符。
Qt.RightArrow 向右移动一字符。
PageUp 向上移动一 (视口) 页。
PageDown 向下移动一 (视口) 页。
首页 移动到文本的起始。
End 移动到文本的结尾。
Alt+Wheel 水平卷动页面 (Wheel 是鼠标滚轮)。
Ctrl+Wheel 缩放文本。
Ctrl+A 选择所有文本。

使用 QPlainTextEdit 作为编辑器

All the information about using PySide.QtGui.QPlainTextEdit as a display widget also applies here.

文本选择的处理通过 PySide.QtGui.QTextCursor 类,提供创建选择、检索文本内容或删除选定的功能。可以检索对应用户可见光标的对象使用 PySide.QtGui.QPlainTextEdit.textCursor() method. If you want to set a selection in PySide.QtGui.QPlainTextEdit just create one on a PySide.QtGui.QTextCursor 对象然后使该光标成为可见光标使用 PySide.QtGui.QWidget.setCursor() . The selection can be copied to the clipboard with PySide.QtGui.QPlainTextEdit.copy() , or cut to the clipboard with PySide.QtGui.QPlainTextEdit.cut() . The entire text can be selected using PySide.QtGui.QPlainTextEdit.selectAll() .

PySide.QtGui.QPlainTextEdit holds a PySide.QtGui.QTextDocument 对象,可以被检索使用 PySide.QtGui.QPlainTextEdit.document() method. You can also set your own document object using PySide.QtGui.QPlainTextEdit.setDocument() . PySide.QtGui.QTextDocument 发射 PySide.QtGui.QPlainTextEdit.textChanged() signal if the text changes and it also provides a isModified() function which will return true if the text has been modified since it was either loaded or since the last call to setModified with false as argument. In addition it provides methods for undo and redo.

编辑键绑定

为编辑而实现的键绑定列表:

Keypresses Action
Backspace 删除光标左侧字符。
Delete 删除光标右侧字符。
Ctrl+C 把选中文本拷贝到剪贴板。
Ctrl+Insert 把选中文本拷贝到剪贴板。
Ctrl+K 删除到行尾。
Ctrl+V 把剪贴板文本粘贴到文本编辑中。
Shift+Insert 把剪贴板文本粘贴到文本编辑中。
Ctrl+X 删除选中文本并把它拷贝到剪贴板。
Shift+Delete 删除选中文本并把它拷贝到剪贴板。
Ctrl+Z 撤消上一操作。
Ctrl+Y 重做上一操作。
LeftArrow 左移光标一字符。
Ctrl+LeftArrow 把光标左移一单词。
RightArrow 右移光标一字符。
Ctrl+RightArrow 把光标右移一单词。
UpArrow 上移光标一行。
Ctrl+UpArrow 把光标上移一单词。
DownArrow 下移光标一行。
Ctrl+Down Arrow 把光标下移一单词。
PageUp 把光标上移一页。
PageDown 把光标下移一页。
首页 把光标移到行开头。
Ctrl+Home 把光标移到文本开头。
End 把光标移到行尾。
Ctrl+End 把光标移到文本末尾。
Alt+Wheel 水平卷动页面 (Wheel 是鼠标滚轮)。
Ctrl+Wheel 缩放文本。

要选择 (标记) 文本,在按住 Shift 键的同时按下某一移动按键,例如, Shift+Right Arrow 将选择右侧字符,而 Shift+Ctrl+Right Arrow 将选择右侧单词,等等。

和 QTextEdit 的差异

PySide.QtGui.QPlainTextEdit is a thin class, implemented by using most of the technology that is behind PySide.QtGui.QTextEdit and PySide.QtGui.QTextDocument 。其性能优于 PySide.QtGui.QTextEdit stem mostly from using a different and simplified text layout called PySide.QtGui.QPlainTextDocumentLayout on the text document (see QTextDocument.setDocumentLayout() ). The plain text document layout does not support tables nor embedded frames, and replaces a pixel-exact height calculation with a line-by-line respectively paragraph-by-paragraph scrolling approach . This makes it possible to handle significantly larger documents, and still resize the editor with line wrap enabled in real time. It also makes for a fast log viewer (see PySide.QtGui.QPlainTextEdit.setMaximumBlockCount() ).

另请参阅

PySide.QtGui.QTextDocument PySide.QtGui.QTextCursor 应用程序范例 代码编辑器范例 句法高亮范例 富文本处理

class PySide.QtGui. QPlainTextEdit ( [ parent=None ] )
class PySide.QtGui. QPlainTextEdit ( text [ , parent=None ] )
参数:

构造空 PySide.QtGui.QPlainTextEdit 采用父级 parent .

构造 PySide.QtGui.QPlainTextEdit 采用父级 parent 。文本编辑将显示纯文本 text .

PySide.QtGui.QPlainTextEdit. LineWrapMode
常量 描述
QPlainTextEdit.NoWrap  
QPlainTextEdit.WidgetWidth  
PySide.QtGui.QPlainTextEdit. anchorAt ( pos )
参数: pos PySide.QtCore.QPoint
返回类型: unicode

返回锚点引用在位置 pos ,或空字符串若该点不存在锚点。

PySide.QtGui.QPlainTextEdit. appendHtml ( html )
参数: html – unicode

追加新段落采用 html 到文本编辑末尾。

PySide.QtGui.QPlainTextEdit.appendPlainText()

PySide.QtGui.QPlainTextEdit. appendPlainText ( text )
参数: text – unicode

追加新段落采用 text 到文本编辑末尾。

PySide.QtGui.QPlainTextEdit. backgroundVisible ( )
返回类型: PySide.QtCore.bool

This property holds whether the palette background is visible outside the document area.

If set to true, the plain text edit paints the palette background on the viewport area not covered by the text document. Otherwise, if set to false, it won't. The feature makes it possible for the user to visually distinguish between the area of the document, painted with the base color of the palette, and the empty area not covered by any document.

默认为 false。

PySide.QtGui.QPlainTextEdit. blockBoundingGeometry ( block )
参数: block PySide.QtGui.QTextBlock
返回类型: PySide.QtCore.QRectF

Returns the bounding rectangle of the text block in content coordinates. Translate the rectangle with the PySide.QtGui.QPlainTextEdit.contentOffset() to get visual coordinates on the viewport.

PySide.QtGui.QPlainTextEdit. blockBoundingRect ( block )
参数: block PySide.QtGui.QTextBlock
返回类型: PySide.QtCore.QRectF

Returns the bounding rectangle of the text block in the block's own coordinates.

PySide.QtGui.QPlainTextEdit. blockCount ( )
返回类型: PySide.QtCore.int

This property holds the number of text blocks in the document..

默认情况下,此特性在空文档中包含 1 值。

PySide.QtGui.QPlainTextEdit. blockCountChanged ( newBlockCount )
参数: newBlockCount PySide.QtCore.int
PySide.QtGui.QPlainTextEdit. canInsertFromMimeData ( source )
参数: source PySide.QtCore.QMimeData
返回类型: PySide.QtCore.bool

This function returns true if the contents of the MIME data object, specified by source , can be decoded and inserted into the document. It is called for example when during a drag operation the mouse enters this widget and it is necessary to determine whether it is possible to accept the drag.

PySide.QtGui.QPlainTextEdit. canPaste ( )
返回类型: PySide.QtCore.bool

返回是否可以把文本从剪贴板粘贴到 textedit。

PySide.QtGui.QPlainTextEdit. centerCursor ( )

卷动文档以使光标垂直居中。

PySide.QtGui.QPlainTextEdit. centerOnScroll ( )
返回类型: PySide.QtCore.bool

This property holds whether the cursor should be centered on screen.

If set to true, the plain text edit scrolls the document vertically to make the cursor visible at the center of the viewport. This also allows the text edit to scroll below the end of the document. Otherwise, if set to false, the plain text edit scrolls the smallest amount possible to ensure the cursor is visible. The same algorithm is applied to any new line appended through PySide.QtGui.QPlainTextEdit.appendPlainText() .

默认为 false。

PySide.QtGui.QPlainTextEdit. clear ( )

删除文本编辑中的所有文本。

Note that the undo/redo history is cleared by this function.

PySide.QtGui.QPlainTextEdit. contentOffset ( )
返回类型: PySide.QtCore.QPointF

返回视口坐标中的内容原点。

The origin of the content of a plain text edit is always the top left corner of the first visible text block. The content offset is different from (0,0) when the text has been scrolled horizontally, or when the first visible block has been scrolled partially off the screen, i.e. the visible text does not start with the first line of the first visible block, or when the first visible block is the very first block and the editor displays a margin.

PySide.QtGui.QPlainTextEdit. copy ( )

把任何选中文本拷贝到剪贴板。

PySide.QtGui.QPlainTextEdit. copyAvailable ( b )
参数: b PySide.QtCore.bool
PySide.QtGui.QPlainTextEdit. createMimeDataFromSelection ( )
返回类型: PySide.QtCore.QMimeData

This function returns a new MIME data object to represent the contents of the text edit's current selection. It is called when the selection needs to be encapsulated into a new PySide.QtCore.QMimeData object; for example, when a drag and drop operation is started, or when data is copied to the clipboard.

If you reimplement this function, note that the ownership of the returned PySide.QtCore.QMimeData object is passed to the caller. The selection can be retrieved by using the PySide.QtGui.QPlainTextEdit.textCursor() 函数。

PySide.QtGui.QPlainTextEdit. createStandardContextMenu ( )
返回类型: PySide.QtGui.QMenu

此函数创建要展示的标准上下文菜单,当用户采用鼠标右键点击行编辑时。它被调用从默认 PySide.QtGui.QPlainTextEdit.contextMenuEvent() 处理程序。弹出菜单的所有权被转移给调用者。

PySide.QtGui.QPlainTextEdit. currentCharFormat ( )
返回类型: PySide.QtGui.QTextCharFormat

返回插入新文本时使用的字符格式。

PySide.QtGui.QPlainTextEdit. cursorForPosition ( pos )
参数: pos PySide.QtCore.QPoint
返回类型: PySide.QtGui.QTextCursor

返回 PySide.QtGui.QTextCursor 在位置 pos (在视口坐标中)。

PySide.QtGui.QPlainTextEdit. cursorPositionChanged ( )
PySide.QtGui.QPlainTextEdit. cursorRect ( cursor )
参数: cursor PySide.QtGui.QTextCursor
返回类型: PySide.QtCore.QRect

返回矩形 (在视口坐标中) 包括 cursor .

PySide.QtGui.QPlainTextEdit. cursorRect ( )
返回类型: PySide.QtCore.QRect

返回包括文本编辑光标的矩形 (在视口坐标中)。

PySide.QtGui.QPlainTextEdit. cursorWidth ( )
返回类型: PySide.QtCore.int

此特性指定光标的宽度 (以像素为单位)。默认值为 1。

PySide.QtGui.QPlainTextEdit. cut ( )

把选中文本拷贝到剪贴板,并将其从文本编辑中删除。

若没有选中文本,什么都不发生。

PySide.QtGui.QPlainTextEdit. document ( )
返回类型: PySide.QtGui.QTextDocument

返回指向底层文档的指针。

PySide.QtGui.QPlainTextEdit. documentTitle ( )
返回类型: unicode

This property holds the title of the document parsed from the text..

默认情况下,此特性包含空字符串。

PySide.QtGui.QPlainTextEdit. ensureCursorVisible ( )

通过卷动文本编辑确保光标是可见的,若有必要。

PySide.QtGui.QPlainTextEdit. extraSelections ( )
返回类型:

返回先前设置的额外选定。

PySide.QtGui.QPlainTextEdit. find ( exp [ , options=0 ] )
参数:
  • exp – unicode
  • options PySide.QtGui.QTextDocument.FindFlags
返回类型:

PySide.QtCore.bool

PySide.QtGui.QPlainTextEdit. firstVisibleBlock ( )
返回类型: PySide.QtGui.QTextBlock

Returns the first visible block.

PySide.QtGui.QPlainTextEdit. getPaintContext ( )
返回类型: PySide.QtGui.QAbstractTextDocumentLayout::PaintContext

Returns the paint context for the PySide.QtGui.QAbstractScrollArea.viewport() , useful only when reimplementing PySide.QtGui.QPlainTextEdit.paintEvent() .

PySide.QtGui.QPlainTextEdit. insertFromMimeData ( source )
参数: source PySide.QtCore.QMimeData

This function inserts the contents of the MIME data object, specified by source , into the text edit at the current cursor position. It is called whenever text is inserted as the result of a clipboard paste operation, or when the text edit accepts data from a drag and drop operation.

PySide.QtGui.QPlainTextEdit. insertPlainText ( text )
参数: text – unicode

方便槽,插入 text 在当前光标位置。

它相当于

edit.textCursor().insertText(text)
												
PySide.QtGui.QPlainTextEdit. isReadOnly ( )
返回类型: PySide.QtCore.bool

This property holds whether the text edit is read-only.

在只读文本编辑中,用户只能导航文本和选择文本;修改文本是不可能的。

此特性默认为 false。

PySide.QtGui.QPlainTextEdit. isUndoRedoEnabled ( )
返回类型: PySide.QtCore.bool

This property holds whether undo and redo are enabled.

Users are only able to undo or redo actions if this property is true, and if there is an action that can be undone (or redone).

默认情况下,此特性为 true。

PySide.QtGui.QPlainTextEdit. lineWrapMode ( )
返回类型: PySide.QtGui.QPlainTextEdit.LineWrapMode

This property holds the line wrap mode.

默认模式为 WidgetWidth 促使单词在文本编辑右边缘换行。换行发生在空白处,保持整个单词完整。若想要换行发生在单词内,使用 PySide.QtGui.QPlainTextEdit.setWordWrapMode() .

PySide.QtGui.QPlainTextEdit. loadResource ( type , name )
参数:
返回类型:

object

加载指定资源通过给定 type and name .

This function is an extension of QTextDocument.loadResource() .

PySide.QtGui.QPlainTextEdit. maximumBlockCount ( )
返回类型: PySide.QtCore.int

This property holds the limit for blocks in the document..

指定文档可能拥有的最大块数。若采用此特性的指定文档有更多块,则块被移除从文档开头。

文档的负值 (或零值) 指定可能包含无限数量的块。

默认值为 0。

注意:设置此特性会把限制立即应用于文档内容。设置此特性还会禁用撤消重做历史。

PySide.QtGui.QPlainTextEdit. mergeCurrentCharFormat ( modifier )
参数: modifier PySide.QtGui.QTextCharFormat

Merges the properties specified in modifier into the current character format by calling QTextCursor::mergeCharFormat on the editor's cursor. If the editor has a selection then the properties of modifier are directly applied to the selection.

PySide.QtGui.QPlainTextEdit. modificationChanged ( arg__1 )
参数: arg__1 PySide.QtCore.bool
PySide.QtGui.QPlainTextEdit. moveCursor ( operation [ , mode=QTextCursor.MoveAnchor ] )
参数:
PySide.QtGui.QPlainTextEdit. overwriteMode ( )
返回类型: PySide.QtCore.bool

This property holds whether text entered by the user will overwrite existing text.

As with many text editors, the plain text editor widget can be configured to insert or overwrite existing text with new text entered by the user.

If this property is true, existing text is overwritten, character-for-character by new text; otherwise, text is inserted at the cursor position, displacing existing text.

By default, this property is false (new text does not overwrite existing text).

PySide.QtGui.QPlainTextEdit. paste ( )

把剪贴板文本粘贴到文本编辑当前光标位置处。

若剪贴板中没有文本,什么都不发生。

To change the behavior of this function, i.e. to modify what PySide.QtGui.QPlainTextEdit can paste and how it is being pasted, reimplement the virtual PySide.QtGui.QPlainTextEdit.canInsertFromMimeData() and PySide.QtGui.QPlainTextEdit.insertFromMimeData() 函数。

PySide.QtGui.QPlainTextEdit. print_ ( printer )
参数: printer PySide.QtGui.QPrinter

方便函数以将文本编辑文档打印到给定 printer . This is equivalent to calling the print method on the document directly except that this function also supports QPrinter.Selection as print range.

另请参阅

QTextDocument.print()

PySide.QtGui.QPlainTextEdit. redo ( )

重做上一操作。

If there is no operation to redo, i.e. there is no redo step in the undo/redo history, nothing happens.

PySide.QtGui.QPlainTextEdit. redoAvailable ( b )
参数: b PySide.QtCore.bool
PySide.QtGui.QPlainTextEdit. selectAll ( )

选择所有文本。

PySide.QtGui.QPlainTextEdit. selectionChanged ( )
PySide.QtGui.QPlainTextEdit. setBackgroundVisible ( visible )
参数: visible PySide.QtCore.bool

This property holds whether the palette background is visible outside the document area.

If set to true, the plain text edit paints the palette background on the viewport area not covered by the text document. Otherwise, if set to false, it won't. The feature makes it possible for the user to visually distinguish between the area of the document, painted with the base color of the palette, and the empty area not covered by any document.

默认为 false。

PySide.QtGui.QPlainTextEdit. setCenterOnScroll ( enabled )
参数: enabled PySide.QtCore.bool

This property holds whether the cursor should be centered on screen.

If set to true, the plain text edit scrolls the document vertically to make the cursor visible at the center of the viewport. This also allows the text edit to scroll below the end of the document. Otherwise, if set to false, the plain text edit scrolls the smallest amount possible to ensure the cursor is visible. The same algorithm is applied to any new line appended through PySide.QtGui.QPlainTextEdit.appendPlainText() .

默认为 false。

PySide.QtGui.QPlainTextEdit. setCurrentCharFormat ( format )
参数: format PySide.QtGui.QTextCharFormat

把新文本插入时使用的字符格式设为 format 通过调用 QTextCursor.setCharFormat() on the editor's cursor. If the editor has a selection then the char format is directly applied to the selection.

PySide.QtGui.QPlainTextEdit. setCursorWidth ( width )
参数: width PySide.QtCore.int

此特性指定光标的宽度 (以像素为单位)。默认值为 1。

PySide.QtGui.QPlainTextEdit. setDocument ( document )
参数: document PySide.QtGui.QTextDocument

Makes document the new document of the text editor.

父级 PySide.QtCore.QObject 文档的提供者仍然是对象的所有者。若当前文档是文本编辑器的子级,则将其删除。

文档必须具有文档布局,继承 PySide.QtGui.QPlainTextDocumentLayout (见 QTextDocument.setDocumentLayout() ).

PySide.QtGui.QPlainTextEdit. setDocumentTitle ( title )
参数: title – unicode

This property holds the title of the document parsed from the text..

默认情况下,此特性包含空字符串。

PySide.QtGui.QPlainTextEdit. setExtraSelections ( selections )
参数: selections
PySide.QtGui.QPlainTextEdit. setLineWrapMode ( mode )
参数: mode PySide.QtGui.QPlainTextEdit.LineWrapMode

This property holds the line wrap mode.

默认模式为 WidgetWidth 促使单词在文本编辑右边缘换行。换行发生在空白处,保持整个单词完整。若想要换行发生在单词内,使用 PySide.QtGui.QPlainTextEdit.setWordWrapMode() .

PySide.QtGui.QPlainTextEdit. setMaximumBlockCount ( maximum )
参数: maximum PySide.QtCore.int

This property holds the limit for blocks in the document..

指定文档可能拥有的最大块数。若采用此特性的指定文档有更多块,则块被移除从文档开头。

文档的负值 (或零值) 指定可能包含无限数量的块。

默认值为 0。

注意:设置此特性会把限制立即应用于文档内容。设置此特性还会禁用撤消重做历史。

PySide.QtGui.QPlainTextEdit. setOverwriteMode ( overwrite )
参数: overwrite PySide.QtCore.bool

This property holds whether text entered by the user will overwrite existing text.

As with many text editors, the plain text editor widget can be configured to insert or overwrite existing text with new text entered by the user.

If this property is true, existing text is overwritten, character-for-character by new text; otherwise, text is inserted at the cursor position, displacing existing text.

By default, this property is false (new text does not overwrite existing text).

PySide.QtGui.QPlainTextEdit. setPlainText ( text )
参数: text – unicode

This property gets and sets the plain text editor's contents. The previous contents are removed and undo/redo history is reset when this property is set.

默认情况下,对于没有内容的编辑器,此特性包含空字符串。

PySide.QtGui.QPlainTextEdit. setReadOnly ( ro )
参数: ro PySide.QtCore.bool

This property holds whether the text edit is read-only.

在只读文本编辑中,用户只能导航文本和选择文本;修改文本是不可能的。

此特性默认为 false。

PySide.QtGui.QPlainTextEdit. setTabChangesFocus ( b )
参数: b PySide.QtCore.bool

此特性保持是否 Tab changes focus or is accepted as input.

In some occasions text edits should not allow the user to input tabulators or change indentation using the Tab key, as this breaks the focus chain. The default is false.

PySide.QtGui.QPlainTextEdit. setTabStopWidth ( width )
参数: width PySide.QtCore.int

此特性保持 Tab (制表符) 停止宽度 (以像素为单位)。

默认情况下,此特性包含 80 的值。

PySide.QtGui.QPlainTextEdit. setTextCursor ( cursor )
参数: cursor PySide.QtGui.QTextCursor

设置可见 cursor .

PySide.QtGui.QPlainTextEdit. setTextInteractionFlags ( flags )
参数: flags PySide.QtCore.Qt.TextInteractionFlags

指定标签应如何与用户输入交互,若它显示文本。

If the flags contain either Qt.LinksAccessibleByKeyboard or Qt.TextSelectableByKeyboard then the focus policy is also automatically set to Qt.ClickFocus .

默认值取决于 PySide.QtGui.QPlainTextEdit 是只读或可编辑。

PySide.QtGui.QPlainTextEdit. setUndoRedoEnabled ( enable )
参数: enable PySide.QtCore.bool

This property holds whether undo and redo are enabled.

Users are only able to undo or redo actions if this property is true, and if there is an action that can be undone (or redone).

默认情况下,此特性为 true。

PySide.QtGui.QPlainTextEdit. setWordWrapMode ( policy )
参数: policy PySide.QtGui.QTextOption.WrapMode
PySide.QtGui.QPlainTextEdit. tabChangesFocus ( )
返回类型: PySide.QtCore.bool

此特性保持是否 Tab changes focus or is accepted as input.

In some occasions text edits should not allow the user to input tabulators or change indentation using the Tab key, as this breaks the focus chain. The default is false.

PySide.QtGui.QPlainTextEdit. tabStopWidth ( )
返回类型: PySide.QtCore.int

此特性保持 Tab (制表符) 停止宽度 (以像素为单位)。

默认情况下,此特性包含 80 的值。

PySide.QtGui.QPlainTextEdit. textChanged ( )
PySide.QtGui.QPlainTextEdit. textCursor ( )
返回类型: PySide.QtGui.QTextCursor

返回副本为 PySide.QtGui.QTextCursor 表示当前可见光标。注意:改变返回光标不影响 PySide.QtGui.QPlainTextEdit ‘s cursor; use PySide.QtGui.QPlainTextEdit.setTextCursor() to update the visible cursor.

PySide.QtGui.QPlainTextEdit. textInteractionFlags ( )
返回类型: PySide.QtCore.Qt.TextInteractionFlags

指定标签应如何与用户输入交互,若它显示文本。

If the flags contain either Qt.LinksAccessibleByKeyboard or Qt.TextSelectableByKeyboard then the focus policy is also automatically set to Qt.ClickFocus .

默认值取决于 PySide.QtGui.QPlainTextEdit 是只读或可编辑。

PySide.QtGui.QPlainTextEdit. toPlainText ( )
返回类型: unicode

This property gets and sets the plain text editor's contents. The previous contents are removed and undo/redo history is reset when this property is set.

默认情况下,对于没有内容的编辑器,此特性包含空字符串。

PySide.QtGui.QPlainTextEdit. undo ( )

撤消上一操作。

若没有要撤消的操作 (即:撤消/重做历史中没有撤消步骤),什么都不发生。

PySide.QtGui.QPlainTextEdit. undoAvailable ( b )
参数: b PySide.QtCore.bool
PySide.QtGui.QPlainTextEdit. updateRequest ( rect , dy )
参数:
PySide.QtGui.QPlainTextEdit. wordWrapMode ( )
返回类型: PySide.QtGui.QTextOption.WrapMode