def supportedDragActions self if self owner role search return QtCore

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
def supportedDragActions(self):
if self.owner.role == 'search':
return QtCore.Qt.CopyAction
if self.owner.role == 'playlist':
return QtCore.Qt.MoveAction
def flags(self, index):
defaultFlags = QtCore.QAbstractItemModel.flags(self, index)
if index.isValid():
return QtCore.Qt.ItemIsDragEnabled | defaultFlags | QtCore.Qt.ItemIsDropEnabled
else:
return QtCore.Qt.ItemIsDropEnabled | defaultFlags
def supportedDropActions(self):
if self.owner.role == 'search':
return QtCore.Qt.IgnoreAction
if self.owner.role == 'playlist':
return QtCore.Qt.MoveAction | QtCore.Qt.CopyAction