QTextDocument Class Reference
[QtGui module]
该另外,QTextDocument类认为,可以查看和编辑使用格式化的文本QTextEdit。More…
继承QObject。
Types
enum FindFlag { FindBackward, FindCaseSensitively, FindWholeWords }
class **[FindFlags]($docs-index.htm)**
enum MetaInformation { DocumentTitle, DocumentUrl }
enum ResourceType { HtmlResource, ImageResource, StyleSheetResource, UserResource }
enum Stacks { UndoStack, RedoStack, UndoAndRedoStacks }
Methods
__init__ (self, QObject parent = None)
__init__ (self, QString text, QObject parent = None)
addResource (self, int type, QUrl name, QVariant resource)
adjustSize (self)
list-of-QTextFormat allFormats (self)
int availableRedoSteps (self)
int availableUndoSteps (self)
QTextBlock begin (self)
int blockCount (self)
QChar characterAt (self, int pos)
int characterCount (self)
clear (self)
clearUndoRedoStacks (self, Stacks stacks = QTextDocument.UndoAndRedoStacks)
QTextDocument clone (self, QObject parent = None)
QTextObject createObject (self, QTextFormat f)
Qt.CursorMoveStyle defaultCursorMoveStyle (self)
QFont defaultFont (self)
QString defaultStyleSheet (self)
QTextOption defaultTextOption (self)
QAbstractTextDocumentLayout documentLayout (self)
float documentMargin (self)
drawContents (self, QPainter p, QRectF rect = QRectF())
QTextBlock end (self)
QTextCursor find (self, QString subString, int position = 0, FindFlags options = 0)
QTextCursor find (self, QRegExp expr, int position = 0, FindFlags options = 0)
QTextCursor find (self, QString subString, QTextCursor cursor, FindFlags options = 0)
QTextCursor find (self, QRegExp expr, QTextCursor cursor, FindFlags options = 0)
QTextBlock findBlock (self, int pos)
QTextBlock findBlockByLineNumber (self, int blockNumber)
QTextBlock findBlockByNumber (self, int blockNumber)
QTextBlock firstBlock (self)
float idealWidth (self)
float indentWidth (self)
bool isEmpty (self)
bool isModified (self)
bool isRedoAvailable (self)
bool isUndoAvailable (self)
bool isUndoRedoEnabled (self)
QTextBlock lastBlock (self)
int lineCount (self)
QVariant loadResource (self, int type, QUrl name)
markContentsDirty (self, int from, int length)
int maximumBlockCount (self)
QString metaInformation (self, MetaInformation info)
QTextObject object (self, int objectIndex)
QTextObject objectForFormat (self, QTextFormat)
int pageCount (self)
QSizeF pageSize (self)
print (self, QPrinter printer)
print_ (self, QPrinter printer)
redo (self)
redo (self, QTextCursor cursor)
QVariant resource (self, int type, QUrl name)
int revision (self)
QTextFrame rootFrame (self)
setDefaultCursorMoveStyle (self, Qt.CursorMoveStyle style)
setDefaultFont (self, QFont font)
setDefaultStyleSheet (self, QString sheet)
setDefaultTextOption (self, QTextOption option)
setDocumentLayout (self, QAbstractTextDocumentLayout layout)
setDocumentMargin (self, float margin)
setHtml (self, QString html)
setIndentWidth (self, float width)
setMaximumBlockCount (self, int maximum)
setMetaInformation (self, MetaInformation info, QString)
setModified (self, bool on = True)
setPageSize (self, QSizeF size)
setPlainText (self, QString text)
setTextWidth (self, float width)
setUndoRedoEnabled (self, bool enable)
setUseDesignMetrics (self, bool b)
QSizeF size (self)
float textWidth (self)
QString toHtml (self, QByteArray encoding = QByteArray())
QString toPlainText (self)
undo (self)
undo (self, QTextCursor cursor)
bool useDesignMetrics (self)
Qt Signals
void blockCountChanged (int)
void contentsChange (int,int,int)
void contentsChanged ()
void cursorPositionChanged (const QTextCursor&)
void documentLayoutChanged ()
void modificationChanged (bool)
void redoAvailable (bool)
void undoAvailable (bool)
void undoCommandAdded ()
Detailed Description
该另外,QTextDocument类认为,可以查看和编辑使用格式化的文本QTextEdit。
另外,QTextDocument是一个容器的结构化富文本文档,提供了样式的文本和各类文档元素,例如列表,表格,框架和图像的支持。它们可以用在被创建QTextEdit或独立使用。
每个文档元素是由一个相关的格式对象描述。每种格式的对象被视为由QTextDocuments一个唯一的对象,并且可以被传递到objectForFormat()来获得,它被应用到文档元素。
一个另外,QTextDocument可以通过编程使用进行编辑QTextCursor的,其内容可以通过遍历文档结构进行检查。整个文档结构被存储为根框架之下文档元素的层次结构,发现了与rootFrame()函数。另外,如果你只是想遍历文档的文本内容,您可以使用begin( )end()和findBlock( )来检索文本块,你可以检查和遍历。
一个文件的布局是由确定的documentLayout( ) ,你可以创建自己的QAbstractTextDocumentLayout子类并使用它设置setDocumentLayout( )如果你想使用自己的布局逻辑。文档的标题和其他元信息可以通过调用来获得metaInformation()函数。对于通过向用户公开文件QTextEdit类,文档标题也可通过QTextEdit.documentTitle()函数。
该toPlainText()和toHtml( )的便利功能允许您检索文件的内容为纯文本和HTML 。该文件的文本,可使用搜索的find()函数。
对文档进行操作的撤消/重做可使用控制setUndoRedoEnabled()函数。撤消/重做系统可以由一个编辑控件通过被控制的undo()和redo( )插槽,该文件还提供了contentsChanged( )undoAvailable()和redoAvailable( )是通知连接编辑器部件有关撤消/重做系统的状态信号。下面是一个另外,QTextDocument的撤消/重做操作:
- Insertion or removal of characters. A sequence of insertions or removals within the same text block are regarded as a single undo/redo operation.
- Insertion or removal of text blocks. Sequences of insertion or removals in a single operation (e.g., by selecting and then deleting text) are regarded as a single undo/redo operation.
- Text character format changes.
- Text block format changes.
- Text block group format changes.
Type Documentation
QTextDocument.FindFlag
这个枚举说明可供选择QTextDocument的发现功能。该选项可以是或的结果一起从下面的列表:
Constant | Value | Description |
---|---|---|
QTextDocument.FindBackward |
0x00001 |
向后搜索,而不是向前。 |
QTextDocument.FindCaseSensitively |
0x00002 |
默认情况下找到工作不区分大小写。指定此选项改变行为,以区分大小写的查找操作。 |
QTextDocument.FindWholeWords |
0x00004 |
使得找到匹配的唯一完整的话。 |
该FindFlags类型是一个typedef为QFlags\u003cFindFlag\u003e 。它存储FindFlag值的或组合。
QTextDocument.MetaInformation
该枚举描述了不同类型的元数据信息可以被添加到文档中。
Constant | Value | Description |
---|---|---|
QTextDocument.DocumentTitle |
0 |
文档的标题。 |
QTextDocument.DocumentUrl |
1 |
该文档的URL 。该loadResource相对于加载资源时( )函数使用这个URL为基础。 |
See also metaInformation()和setMetaInformation( ) 。
QTextDocument.ResourceType
该枚举描述了可以通过以下方式加载的资源类型QTextDocument的loadResource()函数。
Constant | Value | Description |
---|---|---|
QTextDocument.HtmlResource |
1 |
资源包含HTML 。 |
QTextDocument.ImageResource |
2 |
该资源包含图像数据。目前支持的数据类型QVariant.Pixmap和QVariant.Image。如果相应的变量的类型是QVariant.ByteArray然后Qt的尝试使用QImage.loadFromData加载图像。QVariant.Icon目前不支持。需要的图标转换为支持的类型之一第一,例如使用QIcon.pixmap 。 |
QTextDocument.StyleSheetResource |
3 |
该资源包含CSS 。 |
QTextDocument.UserResource |
100 |
用户定义资源类型的第一个可用值。 |
See also loadResource( ) 。
QTextDocument.Stacks
Constant | Value | Description |
---|---|---|
QTextDocument.UndoStack |
0x01 |
撤消堆栈。 |
QTextDocument.RedoStack |
0x02 |
重做堆栈。 |
QTextDocument.UndoAndRedoStacks |
UndoStack | RedoStack |
无论是撤销和重做堆栈。 |
Method Documentation
QTextDocument.__init__ (self, QObject parent = None)
该parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
构造一个空QTextDocument用给定的parent。
QTextDocument.__init__ (self, QString text, QObject parent = None)
该parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
构造一个QTextDocument含有纯(未格式化)text指定,并与给定的parent。
QTextDocument.addResource (self, int type, QUrl name, QVariant resource)
添加资源resource到资源高速缓存,用type和name作为标识符。type应该是从一个值QTextDocument.ResourceType。
例如,您可以以从文档中引用它添加一个图像作为一个资源:
document->addResource([QTextDocument]($docs-qtextdocument.html).ImageResource,
[QUrl](qurl.html)("mydata://image.png"), [QVariant](qvariant.html)(image));
该图像可以通过被插入到文档中的QTextCursorAPI :
[QTextImageFormat]($docs-qtextimageformat.html) imageFormat;
imageFormat.setName("mydata://image.png");
cursor.insertImage(imageFormat);
或者,您可以使用HTML中插入图像img
标籤:
editor->append("<img src=\"mydata://image.png\" />");
QTextDocument.adjustSize (self)
调整文件到一个合理的规模。
这个函数中引入了Qt 4.2中。
See also idealWidth( )textWidth和size。
list-of-QTextFormat QTextDocument.allFormats (self)
返回的文本格式的所有文档中使用的格式的向量。
int QTextDocument.availableRedoSteps (self)
返回可用的重做步骤的数目。
此功能被引入Qt的4.6 。
See also isRedoAvailable( ) 。
int QTextDocument.availableUndoSteps (self)
返回可用撤消的步骤数。
此功能被引入Qt的4.6 。
See also isUndoAvailable( ) 。
QTextBlock QTextDocument.begin (self)
[
返回文档的第一个文本块。
]($docs-qtextblock.html)
See also firstBlock( ) 。
int QTextDocument.blockCount (self)
QChar QTextDocument.characterAt (self, int pos)
返回字符的位置pos,或者一个空字符,如果该位置超出了范围。
此功能被引入Qt的4.5 。
See also characterCount( ) 。
int QTextDocument.characterCount (self)
返回本文件中的字符数。
此功能被引入Qt的4.5 。
See also blockCount()和characterAt( ) 。
QTextDocument.clear (self)
清除文件。
QTextDocument.clearUndoRedoStacks (self, Stacks stacks = QTextDocument.UndoAndRedoStacks)
清除由指定的堆栈stacksToClear。
此方法清除撤消堆栈,重做堆栈,或者两者都有(默认值)的任何命令。如果命令被清除时,适当的信号被发射,QTextDocument.undoAvailable()或QTextDocument.redoAvailable( ) 。
此功能被引入Qt的4.7 。
See also QTextDocument.undoAvailable()和QTextDocument.redoAvailable( ) 。
QTextDocument QTextDocument.clone (self, QObject parent = None)
[
该parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
]($docs-qtextdocument.html)
创建一个新的QTextDocument即这个文本文件的一个副本。parent是返回文本文档的父。
QTextObject QTextDocument.createObject (self, QTextFormat f)
创建并返回一个新的文档对象(一QTextObject) ,根据给定的format。
QTextObjects总是会得到通过这种方法创建的,所以如果你使用自定义的文本对象文档里面你必须重新实现它。
Qt.CursorMoveStyle QTextDocument.defaultCursorMoveStyle (self)
默认光标的运动风格被用于所有QTextCursor从文档中创建的对象。默认值是Qt.LogicalMoveStyle。
此功能被引入Qt的4.8 。
See also setDefaultCursorMoveStyle( ) 。
QFont QTextDocument.defaultFont (self)
[
QString QTextDocument.defaultStyleSheet (self)
](qfont.html)
QTextOption QTextDocument.defaultTextOption (self)
QAbstractTextDocumentLayout QTextDocument.documentLayout (self)
[
返回此文档的文档布局。
]($docs-qabstracttextdocumentlayout.html)
See also setDocumentLayout( ) 。
float QTextDocument.documentMargin (self)
QTextDocument.drawContents (self, QPainter p, QRectF rect = QRectF())
绘制与画家文档的内容p,夹在rect。如果rect是一个空矩形(默认),则该文件被涂别夹子。
这个函数中引入了Qt 4.2中。
QTextBlock QTextDocument.end (self)
[
这个函数返回一个块来测试该文档的末尾,同时遍历它。
]($docs-qtextblock.html)
for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next())
cout << it.text().toStdString() << endl;
返回的块是无效的,并表示文档中的最后一个块后,该块。您可以使用lastBlock()来检索该文件的最后一个有效的块。
See also lastBlock( ) 。
QTextCursor QTextDocument.find (self, QString subString, int position = 0, FindFlags options = 0)
[
查找字符串的下一个出现,subString,在文档中。搜索从给定的位置cursor,并进行转发通过文件,除非在搜索选项另有规定。该options控制执行的搜索类型。
返回一个游标,如果选择的匹配subString被发现,否则返回空指针。
如果给定的cursor有一个选择,开始搜索选择之后,否则它开始在光标所在的位置。
默认情况下,搜索是区分大小写的,并且可以在文档中的任意位置匹配的文本。
]($docs-qtextcursor.html)
QTextCursor QTextDocument.find (self, QRegExp expr, int position = 0, FindFlags options = 0)
查找下一个出现的匹配正则表达式,expr,在文档中。搜索从给定的位置cursor,并进行转发通过文件,除非在搜索选项另有规定。该options控制执行的搜索类型。该FindCaseSensitively选项被忽略这个过载,使用QRegExp.caseSensitivity代替。
返回一个游标,如果找到匹配选择的匹配,否则返回空指针。
如果给定的cursor有一个选择,开始搜索选择之后,否则它开始在光标所在的位置。
默认情况下,搜索是区分大小写的,并且可以在文档中的任意位置匹配的文本。
QTextCursor QTextDocument.find (self, QString subString, QTextCursor cursor, FindFlags options = 0)
[
这是一个重载函数。
查找字符串的下一个出现,subString,在文档中。搜索从给定的position,并进行转发通过文件,除非在搜索选项另有规定。该options控制执行的搜索类型。
返回一个游标,如果选择的匹配subString被发现,否则返回空指针。
如果position为0 (默认) ,搜索将从该文档的开头,否则它开始在指定的位置。
]($docs-qtextcursor.html)
QTextCursor QTextDocument.find (self, QRegExp expr, QTextCursor cursor, FindFlags options = 0)
[
这是一个重载函数。
]($docs-qtextcursor.html)
查找下一个出现的匹配正则表达式,expr,在文档中。搜索从给定的position,并进行转发通过文件,除非在搜索选项另有规定。该options控制执行的搜索类型。该FindCaseSensitively选项被忽略这个过载,使用QRegExp.caseSensitivity代替。
返回一个游标,如果找到匹配选择的匹配,否则返回空指针。
如果position为0 (默认) ,搜索将从该文档的开头,否则它开始在指定的位置。
QTextBlock QTextDocument.findBlock (self, int pos)
[
返回包含文本块pos个字符。
]($docs-qtextblock.html)
QTextBlock QTextDocument.findBlockByLineNumber (self, int blockNumber)
[
返回包含指定的文本块lineNumber。
此功能被引入Qt的4.5 。
]($docs-qtextblock.html)
See also QTextBlock.firstLineNumber( ) 。
QTextBlock QTextDocument.findBlockByNumber (self, int blockNumber)
[
具有指定返回文本块blockNumber。
此功能被引入Qt的4.4 。
]($docs-qtextblock.html)
See also QTextBlock.blockNumber( ) 。
QTextBlock QTextDocument.firstBlock (self)
[
返回文档的第一个文本块。
此功能被引入Qt的4.4 。
float QTextDocument.idealWidth (self)
]($docs-qtextblock.html)
返回文本文档的理想宽度。的理想宽度是该文件的实际使用宽度不考虑可选的路线。它始终是\u003c=size( ) ,宽( ) 。
这个函数中引入了Qt 4.2中。
See also adjustSize()和textWidth。
float QTextDocument.indentWidth (self)
bool QTextDocument.isEmpty (self)
返回True如果该文件是空的,否则返回False 。
bool QTextDocument.isModified (self)
bool QTextDocument.isRedoAvailable (self)
返回True如果重做可用;否则返回False。
See also isUndoAvailable()和availableRedoSteps( ) 。
bool QTextDocument.isUndoAvailable (self)
返回True如果撤消可用;否则返回False。
See also isRedoAvailable()和availableUndoSteps( ) 。
bool QTextDocument.isUndoRedoEnabled (self)
QTextBlock QTextDocument.lastBlock (self)
[
返回文档的最后一个(有效)的文本块。
此功能被引入Qt的4.4 。
int QTextDocument.lineCount (self)
返回该文件的行数(如果布局支持)。否则,这是相同的块的数目。
此功能被引入Qt的4.5 。
]($docs-qtextblock.html)
See also blockCount()和characterCount( ) 。
QVariant QTextDocument.loadResource (self, int type, QUrl name)
将指定的数据加载type从具有给定的资源name。
这个功能是由所谓的富文本引擎不直接通过存储请求数据QTextDocument的,但仍与它相关联。例如,图像是将一个名称属性间接引用QTextImageFormat对象。
当被Qt调用,type是的值中的一个QTextDocument.ResourceType。
如果QTextDocument是的一个子对象QTextEdit,QTextBrowser或QTextDocument本身则默认实现尝试检索从父数据。
QTextDocument.markContentsDirty (self, int from, int length)
标志着由给定的指定的内容position和length为“脏” ,通知它需要被重新布置的文档。
int QTextDocument.maximumBlockCount (self)
QString QTextDocument.metaInformation (self, MetaInformation info)
返回有关指定类型的文件元信息info。
See also setMetaInformation( ) 。
QTextObject QTextDocument.object (self, int objectIndex)
[
返回与给定关联的文本对象objectIndex。
]($docs-qtextobject.html)
QTextObject QTextDocument.objectForFormat (self, QTextFormat)
[
返回与格式相关联的文本对象f。
int QTextDocument.pageCount (self)
返回本文件中的页面的数量。
]($docs-qtextobject.html)
QSizeF QTextDocument.pageSize (self)
[
QTextDocument.print (self, QPrinter printer)
]($docs-qsizef.html)
打印文档给定的printer。该QPrinter必须设置正与该函数使用之前。
这仅仅是一个方便的方法来整份文件打印到打印机。
如果该文件是通过在一个特定的高度已经分页pageSize()属性在打印原样。
如果该文件不分页,例如像在使用一个文件QTextEdit,那么该文件的临时副本被创建和复制是根据的大小分成多个页面QPrinter的paperRect ( ) 。默认情况下2厘米页边距设置在文档中的内容。此外,当前页码印在每一页的底部。
需要注意的是QPrinter.Selection不支持的打印范围使用此功能,因为选择是一个属性QTextCursor。如果你有一个QTextEdit与您相关QTextDocument那么你可以使用QTextEdit的print ( )函数,因为QTextEdit有权访问用户的选择。
See also QTextEdit.print( ) 。
QTextDocument.print_ (self, QPrinter printer)
打印文档给定的printer。该QPrinter必须设置正与该函数使用之前。
这仅仅是一个方便的方法来整份文件打印到打印机。
如果该文件是通过在一个特定的高度已经分页pageSize()属性在打印原样。
如果该文件不分页,例如像在使用一个文件QTextEdit,那么该文件的临时副本被创建和复制是根据的大小分成多个页面QPrinter的paperRect ( ) 。默认情况下2厘米页边距设置在文档中的内容。此外,当前页码印在每一页的底部。
需要注意的是QPrinter.Selection不支持的打印范围使用此功能,因为选择是一个属性QTextCursor。如果你有一个QTextEdit与您相关QTextDocument那么你可以使用QTextEdit的print ( )函数,因为QTextEdit有权访问用户的选择。
See also QTextEdit.print( ) 。
QTextDocument.redo (self)
这种方法也是一个Qt槽与C + +的签名void redo()
。
重做上的文档上一次编辑操作,如果redo is available。
提供cursor定位在其中的出版操作被重做的位置的末端。
这个函数中引入了Qt 4.2中。
QTextDocument.redo (self, QTextCursor cursor)
这是一个重载函数。
重做上的文档上一次编辑操作,如果redo is available。
QVariant QTextDocument.resource (self, int type, QUrl name)
指定的返回数据type从具有给定的资源name。
这个功能是由所谓的富文本引擎不直接通过存储请求数据QTextDocument的,但仍与它相关联。例如,图像是将一个名称属性间接引用QTextImageFormat对象。
资源文件中的内部缓存。如果资源不能在高速缓存中找到, loadResource叫尝试装载该资源。 loadResource应该那么请使用addResource将资源添加到缓存中。
See also QTextDocument.ResourceType。
int QTextDocument.revision (self)
返回文档的版本(如果撤消已启用) 。
修改是保证增加时不修改的文档进行编辑。
此功能被引入Qt的4.4 。
See also QTextBlock.revision()和isModified( ) 。
QTextFrame QTextDocument.rootFrame (self)
[
返回文档的根框架。
QTextDocument.setDefaultCursorMoveStyle (self, Qt.CursorMoveStyle style)
设置默认光标的运动风格,以给定的style。
此功能被引入Qt的4.8 。
]($docs-qtextframe.html)
See also defaultCursorMoveStyle( ) 。
QTextDocument.setDefaultFont (self, QFont font)
QTextDocument.setDefaultStyleSheet (self, QString sheet)
QTextDocument.setDefaultTextOption (self, QTextOption option)
QTextDocument.setDocumentLayout (self, QAbstractTextDocumentLayout layout)
该layout说法有它的所有权转移给Qt的。
设置要使用的特定文件layout。以前的布局将被删除。
See also documentLayoutChanged( ) 。
QTextDocument.setDocumentMargin (self, float margin)
QTextDocument.setHtml (self, QString html)
替换该文件的全部内容以在给定的HTML格式的文本html字符串。
在HTML格式的尊重,尽可能,例如, “ \u003cb\u003e粗体\u003c / B\u003e正文”将产生的文本,其中第一个字有一个字体的粗细,给它一个大胆的外观: “bold文本“ 。
Note:它是调用者的责任,以确保文本正确解码时,QString包含HTML创建并传递给setHtml ( ) 。
See also setPlainText()和Supported HTML Subset。
QTextDocument.setIndentWidth (self, float width)
QTextDocument.setMaximumBlockCount (self, int maximum)
QTextDocument.setMetaInformation (self, MetaInformation info, QString)
设置由指定类型的文件的元数据信息info为给定的string。
See also metaInformation( ) 。
QTextDocument.setModified (self, bool on = True)
这种方法也是一个Qt槽与C + +的签名void setModified(bool = 1)
。
QTextDocument.setPageSize (self, QSizeF size)
QTextDocument.setPlainText (self, QString text)
替换该文件的整个内容与给定的纯text。
See also setHtml( ) 。
QTextDocument.setTextWidth (self, float width)
QTextDocument.setUndoRedoEnabled (self, bool enable)
QTextDocument.setUseDesignMetrics (self, bool b)
QSizeF QTextDocument.size (self)
[
float QTextDocument.textWidth (self)
QString QTextDocument.toHtml (self, QByteArray encoding = QByteArray())
返回一个包含文档的HTML表示形式的字符串。
该encoding参数指定用于在HTML头中的charset属性的值。例如,如果指定’UTF - 8’ ,然后将生成的HTML的开始看起来像这样:
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>...
如果没有指定编码,然后不产生这样的元信息。
如果您以后在返回的HTML字符串转换成字节数组传输通过网络或保存到磁盘时,你应该指定编码你要在这里为转换为字节数组使用。
]($docs-qsizef.html)
See also Supported HTML Subset。
QString QTextDocument.toPlainText (self)
返回包含在文档中的纯文本。如果你想格式化信息使用QTextCursor代替。
See also toHtml( ) 。
QTextDocument.undo (self)
这种方法也是一个Qt槽与C + +的签名void undo()
。
撤消对文档的最后一个编辑操作,如果撤消可用。提供cursor定位在其中的出版操作已撤消的位置的末端。
请参阅Qt Undo Framework文档。
这个函数中引入了Qt 4.2中。
See also undoAvailable()和isUndoRedoEnabled( ) 。
QTextDocument.undo (self, QTextCursor cursor)
这是一个重载函数。
bool QTextDocument.useDesignMetrics (self)
Qt Signal Documentation
void blockCountChanged (int)
这是该信号的默认超载。
这个信号被发射时的文本块中的文件的修改的总数。在传递的值newBlockCount是新的总和。
此功能被引入Qt的4.3 。
void contentsChange (int,int,int)
这是该信号的默认超载。
这个信号被发射时该文档的内容更改,例如,当文本被插入或删除,或格式化时被应用。
信息提供有关position字符的变化发生的位置在文件中的,字符数去除(charsRemoved),以及字符数加(charsAdded) 。
该信号发出之前,该文档的布局管理器会通知有关更改。这个钩子可以让你实现语法高亮显示的文档。
See also QAbstractTextDocumentLayout.documentChanged()和contentsChanged( ) 。
void contentsChanged ()
这是该信号的默认超载。
这个信号被发射时该文档的内容更改,例如,当文本被插入或删除,或格式化时被应用。
See also contentsChange( ) 。
void cursorPositionChanged (const QTextCursor&)
这是该信号的默认超载。
这个信号被发射时的光标的位置改变了由于编辑操作。改变了光标在传递cursor。如果你需要一个信号,当光标移动的箭头键,您可以使用cursorPositionChanged()在信号QTextEdit。
void documentLayoutChanged ()
这是该信号的默认超载。
当一个新的文档布局设置这个信号被发射。
此功能被引入Qt的4.4 。
See also setDocumentLayout( ) 。
void modificationChanged (bool)
这是该信号的默认超载。
这个信号被发射时在文档的内容改变了,影响到修改状态的方法。如果changed诚然,该文件已被修改,否则为假。
例如,调用SetModified之(假)上的文档,然后插入文本引起来获得所发出的信号。如果撤消操作,使所述的文件返回到其原始未修饰的状态下,信号将得到再次发射。
void redoAvailable (bool)
这是该信号的默认超载。
这个信号被发射时重做操作变得可用(available为True)或不可用(available是假的) 。
void undoAvailable (bool)
这是该信号的默认超载。
这个信号被发射时撤销操作变得可用(available为True)或不可用(available是假的) 。
请参阅Qt Undo Framework文档。
See also undo()和isUndoRedoEnabled( ) 。
void undoCommandAdded ()
这是该信号的默认超载。
每撤消一个新的水平被添加到时间这个信号被发射QTextDocument。
此功能被引入Qt的4.4 。