Disable drag and drop (todo: fix in qt6)

This commit is contained in:
Keith Edmunds 2023-04-13 14:45:29 +01:00
parent a8ffa6f231
commit 32cc0468e8

View File

@ -189,13 +189,13 @@ class PlaylistTab(QTableWidget):
self.resizeRowsToContents)
# Drag and drop setup
self.setAcceptDrops(True)
# TODO: fix drag and drop for qt6
self.setAcceptDrops(False)
self.viewport().setAcceptDrops(True)
self.setDragDropOverwriteMode(False)
self.setDropIndicatorShown(True)
self.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
self.setDragEnabled(False)
# This property defines how the widget shows a context menu
self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
# This signal is emitted when the widget's contextMenuPolicy is
@ -291,7 +291,8 @@ class PlaylistTab(QTableWidget):
"""
if self.selectedItems():
self.setDragEnabled(True)
# TODO: fix drag and drop
self.setDragEnabled(False)
else:
self.setDragEnabled(False)
super().mouseReleaseEvent(event)
@ -1156,11 +1157,12 @@ class PlaylistTab(QTableWidget):
https://stackoverflow.com/questions/26227885/drag-and-drop-rows-within-qtablewidget
"""
index = self.indexAt(event.pos())
position = event.position().toPoint()
index = self.indexAt(position)
if not index.isValid():
return self.rowCount()
return (index.row() + 1 if self._is_below(event.pos(), index)
return (index.row() + 1 if self._is_below(position, index)
else index.row())
def _find_next_track_row(self, session: scoped_session,