本文整理汇总了Python中PyQt4.QtCore.QMimeData.setHtml方法的典型用法代码示例。如果您正苦于以下问题:Python QMimeData.setHtml方法的具体用法?Python QMimeData.setHtml怎么用?Python QMimeData.setHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QMimeData
的用法示例。
在下文中一共展示了QMimeData.setHtml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _copy
# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setHtml [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: copyColoredHtml
# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setHtml [as 别名]
def copyColoredHtml(self):
cursor = self.textCursor()
if not cursor.hasSelection():
return
number_lines = QSettings().value("source_export/number_lines", False, bool)
inline_style = QSettings().value("source_export/inline_copy", True, bool)
as_plain_text = QSettings().value("source_export/copy_html_as_plain_text", False, bool)
document_body_only = QSettings().value("source_export/copy_document_body_only", False, bool)
import highlight2html
html = highlight2html.html_inline(cursor, inline=inline_style, number_lines=number_lines,
full_html=not document_body_only)
data = QMimeData()
data.setText(html) if as_plain_text else data.setHtml(html)
QApplication.clipboard().setMimeData(data)
示例3: copyColoredHtml
# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setHtml [as 别名]
def copyColoredHtml(self):
cursor = self.textCursor()
if not cursor.hasSelection():
return
s = QSettings()
s.beginGroup("source_export")
number_lines = s.value("number_lines", False, bool)
inline_style = s.value("inline_copy", True, bool)
as_plain_text = s.value("copy_html_as_plain_text", False, bool)
wrap_tag = s.value("wrap_tag", "pre", str)
wrap_attrib = s.value("wrap_attrib", "id", str)
wrap_attrib_name = s.value("wrap_attrib_name", "document", str)
document_body_only = s.value("copy_document_body_only", False, bool)
import highlight2html
html = highlight2html.html_inline(cursor, inline=inline_style, number_lines=number_lines,
full_html=not document_body_only, wrap_tag=wrap_tag, wrap_attrib=wrap_attrib,
wrap_attrib_name=wrap_attrib_name)
data = QMimeData()
data.setText(html) if as_plain_text else data.setHtml(html)
QApplication.clipboard().setMimeData(data)
示例4: _drag_hmtl
# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setHtml [as 别名]
def _drag_hmtl ( self, html ):
mime_data = QMimeData()
mime_data.setHtml( html )
return mime_data