Hi,

I have a custom treemodel and a treeview, with a QSortFilterProxyModel in between (all in PyQt4). It looks like this:


Now, I want to drag images from the listview (the widget in the middle) to the treeview, but only on second level items (the ones with the colored circles in front of them). I want to use setAutoExpandDelay, so that top level items get expanded when a drag hovers over them. I've got a couple of problems, though:

  1. If I hover over a second level element, Qt apparently tries to expand it, although it has no children. The outline around the hovered item vanishes, and the following error messages are printed:
    Qt Code:
    1. QPainter::begin: Paint device returned engine == 0, type: 2
    2. QPainter::setWorldTransform: Painter not active
    3. QPainter::end: Painter not active, aborted
    To copy to clipboard, switch view to plain text mode 

    My model correctly returns a rowCount of zero, so I have no idea why Qt wants to expand them.
  2. When I hover over a top level item, Qt expands it as expected. But when I hover over a second top level item during the same drag operation, it doesn't get expanded.


I checked my model with ModelTest, it doesn't detect any errors in my model.

Here's my treeview, and my tree model