Code:
The class FileTreeView (QTreeView) :
Def __init__ (self, parent=None) :
Super () __init__ (parent)
Self. SetDragEnabled (True)
Self. SetAcceptDrops (True)
Self. SetDragDropMode (QAbstractItemView. DragDrop)
Self. SetDefaultDropAction (Qt. CopyAction)
And then use this class behind:
The self. The UI. File_view=FileTreeView (self. UI. LayoutWidget)
The self. The UI. File_view. SetObjectName (" file_view ")
The self. The UI. The verticalLayout. AddWidget (self. UI. File_view)
And then set the model:
The self. The model=QFileSystemModel (self)
The self. The UI. File_view. SetModel (self. Model)
But found to drag and drop.
Because can't screenshots when drag and drop, so can't let you see the effect of failure, as a general description is a red symbol is prohibited.
Does anyone know why?
CodePudding user response:
Does anyone know? Urgent, etc!CodePudding user response:
Does anyone know? Urgent, etc!