Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGraphicsWidget is always drawn over the QGraphicsLineItem irrespective of the z order



  • I have a graphics scene which contains a QGraphicsWidget and a QGraphicsLineItem. The
    issue I am facing is that the QGraphicsWidget is getting drawn over the QGraphicsLineItem
    whenever I move the pointer over the QGraphicsWidget, whereas I want the QGraphicsLineItem to
    be on top always in the scene, without being affected by the repaint of QGraphicsWidget.

    I have tried the setZValue() api, but it is not of showing any effect

    These are the elements in the scene with details,

    Scene----------> QGraphicsWidget ----> QGraphicsLinearLayout-----> Array of layout items
    |
    |
    --------> QGraphicsLineItem

    Any help will be much appreciated...



  • Can you show some code? For example, what kind of QGraphicsWidget are we talking about? What does it paint?



  • Hi,

    I was able to fix the issue. The issue was due to the incorrect bounding rect given for the line item.

    Thanks,
    San


Log in to reply