Important: Please read the Qt Code of Conduct -

Highlight Items rect beneath mouse cursor of QGraphicsProxyWidget

  • I have so many items inside QGraphicsProxyWidget and want to get the rect of item which is under mouse cursor.
    Did this:
    QPoint m_globalMousePos = e->globalPos(); //in mouseMove Event of some other class

    void handleGraphicsProxyWidget(QGraphicsProxyWidget proxyWidget){
    widget = proxyWidget->widget()->childAt(proxyWidget->widget()->mapFromGlobal(m_globalMousePos));

    It gives me the correct item from QGraphicsProxyWidget as widget if scaling is not applied on view (QGraphicsView in which this proxyWidget lies), means item which is under mouse cursor.
    But if scaling happens on graphicsView then I am not getting the proper item.

    I inspect little and found that after scaling proxyWidget->widget() gives same rect as earlier without scaling, that's why mapping is not occurring correct.

    Please let me know how to get the item of QGraphicsProxyWidget when scaling is applied on view.