[PySide] but with QListView and drag&drop?

Frank Rueter | OHUfx frank at ohufx.com
Tue Aug 16 03:04:55 CEST 2016


Hi guys,

I just ran into the problem that my custom QListView class wouldn't 
accept drop events.
After a bit of poking I found that the culprit was the 
QtGui.QListView.IconMode which seemed to reject drop events as a side 
effect (bug or feature I don't know).
So I then proceeded to use setAcceptDrops(True) to explicitly allow drop 
events, but to no avail.

However, and this is what feels like a bug, if I use 
setAcceptDrops(False) it does accept drop events.
Am I misunderstanding the use of this or is this a bug?

Some examples:

this will accept drop events:
     view = QtGui.QListView()

this will NOT accept drop events (contrary to the docs 
<https://srinikom.github.io/pyside-docs/PySide/QtGui/QListView.html#PySide.QtGui.PySide.QtGui.QListView.setViewMode>):

     view = QtGui.QListView()
     view.setViewMode(QtGui.QListView.*IconMode*)

this will NOT accept drop events (bug?):

     view = QtGui.QListView()
     view.setViewMode(QtGui.QListView.IconMode)
     view.setAcceptDrops(*True*)

this will accept drop events (bug?):

     view = QtGui.QListView()
     view.setViewMode(QtGui.QListView.IconMode)
     view.setAcceptDrops(*False*)

I am using PySide 1.2.2 and QT 4.8.7

Cheers,
frank


-- 
ohufxLogo 50x50 <http://www.ohufx.com> 	*vfx compositing 
<http://ohufx.com/index.php/vfx-compositing> | *workflow customisation 
and consulting <http://ohufx.com/index.php/vfx-customising>* *

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20160816/538b1031/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ohufxLogo_50x50.png
Type: image/png
Size: 2666 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20160816/538b1031/attachment.png>


More information about the PySide mailing list