Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
5.14.0
-
None
-
I'm on Windows 10, someone experienced the same on macOS.
-
-
fa17f867c2dd33aadefa6fe95f80831a83a64a10 (pyside/pyside-setup/5.14)
Description
Trying to create a little custom QListView for dragging by implementing mimeTypes and mimeData as follows causes the application to crash.
MRP:
import sys from PySide2.QtWidgets import QApplication, QMainWindow, QListWidget, QListWidgetItem, QAbstractItemView from PySide2.QtCore import QMimeData, QByteArray class ClassesListWidget(QListWidget): def __init__(self): super(ClassesListWidget, self).__init__() self.addItem(QListWidgetItem('first')) self.addItem(QListWidgetItem('second')) self.setSelectionMode(QAbstractItemView.SingleSelection) self.setDragEnabled(True) self.viewport().setAcceptDrops(True) self.setDropIndicatorShown(True) def mimeTypes(self): return ['text/plain'] def mimeData(self, items): mime_data = QMimeData() data = QByteArray(bytes('testdata', 'utf-8')) mime_data.setData('text/plain', data) return mime_data class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.setCentralWidget(ClassesListWidget()) if __name__ == '__main__': app = QApplication(sys.argv) mw = MainWindow() mw.show() sys.exit(app.exec_())
Attachments
Issue Links
- is duplicated by
-
PYSIDE-2052 Seg fault occurs when dragging from a QTableView
- Closed
-
PYSIDE-728 Seg fault occurs when dragging from a QTreeWidget that has a reimplemented mimeData func
- Closed