本文整理汇总了Python中PyQt5.Qt.QTextCursor.deleteChar方法的典型用法代码示例。如果您正苦于以下问题:Python QTextCursor.deleteChar方法的具体用法?Python QTextCursor.deleteChar怎么用?Python QTextCursor.deleteChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QTextCursor
的用法示例。
在下文中一共展示了QTextCursor.deleteChar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createDocument
# 需要导入模块: from PyQt5.Qt import QTextCursor [as 别名]
# 或者: from PyQt5.Qt.QTextCursor import deleteChar [as 别名]
def createDocument(self, rootFrame):
# Create empty document
self.document = QTextDocument()
self.document.setUndoRedoEnabled(False)
self.document.setIndentWidth(20)
# Register a renderer for custom text objects
mo = CustomObjectRenderer()
mo.setParent(self.document)
self.document.documentLayout().registerHandler(QTextCharFormat.UserObject+1, mo);
self.cursor = QTextCursor(self.document)
self.listLevel = 0
self.paraFormat = None
# add all root paragraphs
for n in rootFrame.children:
self.addNode(n)
# Clean up the first paragraph if document is not empty
self.cursor.movePosition(QTextCursor.Start)
b = self.cursor.block()
if b.length() == 1:
cursor = QTextCursor(self.document.findBlockByLineNumber(0))
cursor.select(QTextCursor.BlockUnderCursor)
cursor.deleteChar()
return self.document