本文整理汇总了Python中PyQt5.QtWidgets.QFileSystemModel.dropMimeData方法的典型用法代码示例。如果您正苦于以下问题:Python QFileSystemModel.dropMimeData方法的具体用法?Python QFileSystemModel.dropMimeData怎么用?Python QFileSystemModel.dropMimeData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QFileSystemModel
的用法示例。
在下文中一共展示了QFileSystemModel.dropMimeData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dropMimeData
# 需要导入模块: from PyQt5.QtWidgets import QFileSystemModel [as 别名]
# 或者: from PyQt5.QtWidgets.QFileSystemModel import dropMimeData [as 别名]
def dropMimeData(self, data, action, row, column, parent):
# print 'dropMimeData %s %s %s %s' % (data.data('text/uri-list'), action, row, parent)
# print data.text()
# print data.formats()
# print data.data('text/uri-list')
# print row, "row"
# print column, "col"
# print action, "action"
# print parent, "parent"
# print parent.data(Qt.DisplayRole),"parent"
filePath = data.data('text/uri-list').data()[7:]
# filesFolderPath = filePath # canonical , os path parent falan
fileName = os.path.basename(filePath)
# fileName = ""
# print type(filePath.data())
# print fileName
# os.path.normpath(unicode(self.model().fileInfo(self.selectedIndexes()[0]).absoluteFilePath()))
# dfolder = self.fileInfo(parent).absoluteFilePath()
destFinalPath = os.path.normpath("%s/%s" % (self.filePath(parent), fileName))
# ya da emit.fileMoved filepath move to destFolder+filename
self.fileDraggedAndMoved.emit("%s --------> %s" % (filePath, destFinalPath))
# return True
return QFileSystemModel.dropMimeData(self, data, action, row, column, parent)