Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PySide6: drag and drop broken after updating to 6.5.2
Forum Updated to NodeBB v4.3 + New Features

PySide6: drag and drop broken after updating to 6.5.2

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 614 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sam Nystrom
    wrote on last edited by
    #1

    Hi! I updated my Qt/PySide6 version from 6.5.1.1 to 6.5.2 today and my drag-and-drop code no longer works. I've pasted a minimal example below. I would expect the ListView item to follow the mouse when dragged, but instead the cursor turns into a Qt.ForbiddenCursor. In my real code I have the user dragging items from a ListView into a TreeView.

    import sys
    from PySide6 import QtGui, QtWidgets, QtCore
    
    class MainWindow(QtWidgets.QMainWindow):
        def __init__(self, parent=None):
            super().__init__(parent)
            self.model = QtGui.QStandardItemModel()
            item = QtGui.QStandardItem()
            item.setText('foo')
            item.setFlags(item.flags() | QtCore.Qt.ItemIsDragEnabled)
            self.model.appendRow(item)
    
            view = QtWidgets.QListView()
            view.setModel(self.model)
            view.setDragEnabled(True)
            self.setCentralWidget(view)
    
    
    application = QtWidgets.QApplication(sys.argv)
    window = MainWindow()
    window.show()
    sys.exit(application.exec())
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      I just tested your code on macOS with PySide6 6.5.2 and it's working as expected.

      Which OS are you on ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved