本文整理汇总了Python中PyQt5.QtCore.QMimeData.setHtml方法的典型用法代码示例。如果您正苦于以下问题:Python QMimeData.setHtml方法的具体用法?Python QMimeData.setHtml怎么用?Python QMimeData.setHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QMimeData
的用法示例。
在下文中一共展示了QMimeData.setHtml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mimeData
# 需要导入模块: from PyQt5.QtCore import QMimeData [as 别名]
# 或者: from PyQt5.QtCore.QMimeData import setHtml [as 别名]
def mimeData(self, indexes):
# Create MimeData for drag operation
data = QMimeData()
# Get list of all selected file ids
files = []
for item in indexes:
selected_row = self.itemFromIndex(item).row()
files.append(self.item(selected_row, 4).text())
data.setText(json.dumps(files))
data.setHtml("effect")
# Return Mimedata
return data
示例2: copyColoredHtml
# 需要导入模块: from PyQt5.QtCore import QMimeData [as 别名]
# 或者: from PyQt5.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)
示例3: copyHtml
# 需要导入模块: from PyQt5.QtCore import QMimeData [as 别名]
# 或者: from PyQt5.QtCore.QMimeData import setHtml [as 别名]
def copyHtml(self):
mimeData = QMimeData()
mimeData.setHtml("<b>Bold and <font color=red>Red</font></b>")
clipboard = QApplication.clipboard()
clipboard.setMimeData(mimeData)