当前位置: 首页>>代码示例>>Python>>正文


Python QTextDocument.toPlainText方法代码示例

本文整理汇总了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)
开发者ID:hannesrauhe,项目名称:lunchinator,代码行数:10,代码来源:chat_widget.py

示例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())
开发者ID:hannesrauhe,项目名称:lunchinator,代码行数:21,代码来源:__init__.py

示例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() ) )
开发者ID:achayan,项目名称:anim-studio-tools,代码行数:22,代码来源:versionitemwidget.py


注:本文中的PyQt4.QtGui.QTextDocument.toPlainText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。