本文整理汇总了Python中PyQt4.QtGui.QTextDocument.toPlainText方法的典型用法代码示例。如果您正苦于以下问题:Python QTextDocument.toPlainText方法的具体用法?Python QTextDocument.toPlainText怎么用?Python QTextDocument.toPlainText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QTextDocument
的用法示例。
在下文中一共展示了QTextDocument.toPlainText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _copy
# 需要导入模块: from PyQt4.QtGui import QTextDocument [as 别名]
# 或者: from PyQt4.QtGui.QTextDocument import toPlainText [as 别名]
def _copy(self, index):
doc = QTextDocument()
doc.setHtml(index.data(Qt.DisplayRole).toString())
clipboard = QApplication.clipboard()
richTextData = QMimeData()
richTextData.setHtml(index.data(Qt.DisplayRole).toString())
richTextData.setText(doc.toPlainText())
clipboard.setMimeData(richTextData)
示例2: _displayMessage
# 需要导入模块: from PyQt4.QtGui import QTextDocument [as 别名]
# 或者: from PyQt4.QtGui.QTextDocument import toPlainText [as 别名]
def _displayMessage(self, otherID, msgHTML, msgTime, msgDict):
try:
recvTime = time()
chatWindow = self.openChat(otherID, False)
chatWindow.getChatWidget().addOtherMessage(msgHTML, msgTime, recvTime)
self._messagesHandler.receivedSuccessfully(otherID, msgHTML, msgTime, msgDict, recvTime)
except:
excType, excValue, _tb = sys.exc_info()
errorMsg = u"Error processing message (%s: %s)" % (unicode(excType.__name__), unicode(excValue))
self._messagesHandler.errorReceivingMessage(otherID, msgDict, errorMsg)
if not chatWindow.isActiveWindow():
from PyQt4.QtGui import QTextDocument
doc = QTextDocument()
doc.setHtml(msgHTML)
displayNotification(chatWindow.getChatWidget().getOtherName(),
convert_string(doc.toPlainText()),
self.logger,
chatWindow.getChatWidget().getOtherIconPath())
示例3: resizeEvent
# 需要导入模块: from PyQt4.QtGui import QTextDocument [as 别名]
# 或者: from PyQt4.QtGui.QTextDocument import toPlainText [as 别名]
def resizeEvent( self, event ):
super(VersionItemWidget,self).resizeEvent(event)
# make sure we have finished initializing before we resize
if ( not '_version' in self.__dict__ ):
return
metrics = QFontMetrics(self.font())
version = self._version
# update the labels with eliding based on new spacing
self.uiUserLBL.setText( metrics.elidedText( version.username(), Qt.ElideRight, self.uiUserLBL.width() ) )
# convert out any html data
comments = str(version.comments())
doc = QTextDocument()
doc.setHtml(comments)
comments = str(doc.toPlainText())
self.uiCommentsLBL.setText( metrics.elidedText( comments.replace('\n',' '), Qt.ElideRight, self.uiCommentsLBL.width() ) )