It is possible to drag and drop files normally without packaging. After packaging, I found that I couldn't drag it anymore
Unsolved
Qt for Python
-
from PySide6.QtWidgets import QApplication, QMainWindow, QListWidget from PySide6.QtCore import Qt class MainWindow(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Drag and Drop Example") self.list_widget = QListWidget(self) self.setCentralWidget(self.list_widget) print(self.acceptDrops()) self.setAcceptDrops(True) def dragEnterEvent(self, event): if event.mimeData().hasUrls(): event.acceptProposedAction() def dropEvent(self, event): for url in event.mimeData().urls(): file_path = url.toLocalFile() print("Dropped file:", file_path) self.list_widget.addItem(file_path) if __name__ == "__main__": app = QApplication([]) window = MainWindow() window.setGeometry(100, 100, 400, 300) window.show() app.exec()
-
Hi,
How are you doing the packaging ?
On which OS ? -
At present, it's okay. We have found a solution. Thank you
-
What was the issue ? It might help other people.