本文整理汇总了Python中PyQt5.QtCore.QMimeData.urls方法的典型用法代码示例。如果您正苦于以下问题:Python QMimeData.urls方法的具体用法?Python QMimeData.urls怎么用?Python QMimeData.urls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QMimeData
的用法示例。
在下文中一共展示了QMimeData.urls方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dropMimeData
# 需要导入模块: from PyQt5.QtCore import QMimeData [as 别名]
# 或者: from PyQt5.QtCore.QMimeData import urls [as 别名]
def dropMimeData(self, mime_data: QtCore.QMimeData,
drop_actions: QtCore.Qt.DropActions,
row: int, column: int,
index: QtCore.QModelIndex) -> bool:
urls = mime_data.urls()
for url in urls:
print(url)
print(url.path())
# self.file_uploading.emit(url.path()[1:], self.item(index).file_path)
return True
示例2: dropMimeData
# 需要导入模块: from PyQt5.QtCore import QMimeData [as 别名]
# 或者: from PyQt5.QtCore.QMimeData import urls [as 别名]
def dropMimeData(self, mime_data: QtCore.QMimeData,
drop_actions: QtCore.Qt.DropActions,
row: int, column: int,
index: QtCore.QModelIndex):
if not index.isValid() or not drop_actions & QtCore.Qt.CopyAction:
return False
urls = mime_data.urls()
root = mime_data.property('root')
print(root)
for url in urls:
source_path = os.path.dirname(url.path())
filename = os.path.basename(url.path())
print(source_path)
print(filename)
target_path = self.filePath(index)
print(target_path)
if root != '':
target_path += source_path[source_path.index(root):]
print(target_path)
self.file_downloading.emit(source_path, target_path, filename)
return True