Skip to content

feat: drag-n-drop into other applications #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions tagstudio/src/qt/widgets/item_thumb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from typing import Optional

from PIL import Image, ImageQt
from PySide6.QtCore import Qt, QSize, QEvent
from PySide6.QtGui import QPixmap, QEnterEvent, QAction
from PySide6.QtCore import Qt, QSize, QEvent, QMimeData, QUrl
from PySide6.QtGui import QPixmap, QEnterEvent, QAction, QDrag
from PySide6.QtWidgets import (
QWidget,
QVBoxLayout,
Expand Down Expand Up @@ -495,3 +495,17 @@ def toggle_tag(entry: Entry):
if self.panel.isOpen:
self.panel.update_widgets()
self.panel.driver.update_badges()

def mouseMoveEvent(self, event):

# ignore if no left button is pressed
if not (event.buttons() & Qt.LeftButton):
return

# simple drag-n-drop into other applications
if self.mode == ItemType.ENTRY:
drag = QDrag(self)
mimeData = QMimeData()
mimeData.setUrls([QUrl.fromLocalFile(str(self.opener.filepath))])
drag.setMimeData(mimeData)
dropAction = drag.exec(Qt.DropAction.CopyAction)