mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-18 11:52:25 +12:00
ff2cbca028
Some snippets have yet to be converted due to the more complex nature of those snippets, and to keep things neat a separate commit makes more sense for those.
20 lines
660 B
Python
20 lines
660 B
Python
#!/usr/bin/env python
|
|
# --!-- coding: utf8 --!--
|
|
from PyQt5.QtCore import Qt
|
|
from PyQt5.QtWidgets import QAbstractItemView
|
|
|
|
|
|
class dndView(QAbstractItemView):
|
|
def __init__(self, parent=None):
|
|
# QAbstractItemView.__init__(self, parent)
|
|
self.setDragDropMode(self.DragDrop)
|
|
self.setDefaultDropAction(Qt.MoveAction)
|
|
self.setSelectionMode(self.ExtendedSelection)
|
|
|
|
def dragMoveEvent(self, event):
|
|
# return QAbstractItemView.dragMoveEvent(self, event)
|
|
if event.keyboardModifiers() & Qt.ControlModifier:
|
|
event.setDropAction(Qt.CopyAction)
|
|
else:
|
|
event.setDropAction(Qt.MoveAction)
|