Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.7.0
-
None
Description
So, I have QTreeView embedded in QGraphicsProxyWidget. And QTreeView does not auto expand branches while drag and dropping due to incorrect calculations of coordinates.
How it doesn't work.
There is void timerEvent(QTimerEvent *event) in QTreeView class:
QPoint pos = d->viewport->mapFromGlobal(QCursor::pos());
if (state() == QAbstractItemView::DraggingState
&& d->viewport->rect().contains(pos)) {
QModelIndex index = indexAt(pos);
setExpanded(index, !isExpanded(index));
}
Error is in "QPoint pos = d->viewport->mapFromGlobal(QCursor::pos());". It tries to map global coordinates to viewport's coordinates, but viewport's rect EQUALS the rect of QGraphicsProxyWidget in QGraphicsScene! And rect of QGraphicsProxyWidget in QGraphicsScene is always the same (x=70, y=0), independently of MainWindow position on the screen!
How can I solve the problem?
PS Yes, I called setAutoExpandDelay(10);
d->openTimer.stop();