QGraphicsProxyWidget is not transparent proxy



  • 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));
    }
    d->openTimer.stop();
    @

    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? Or is it bug?

    PS Yes, I called setAutoExpandDelay(10);


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.