Qt在同一个QGraphicsScene中插入两个不同的QGraphicsWidgets,setZValue无效

Qt Insert two different QGraphicsWidgets in the same QGraphicsScene, setZValue is invalid

当两个 QGraphicsWidget 可见重叠时调用 collidingItems,但 returns 为空

QGraphicsWidget0QGraphicsWidget1 继承自 QGraphicsWidget。 最终我看到 icon1 显示在顶部,如何在不更改插入顺序的情况下让 icon1 显示在底部?

icon0= new QGraphicsWidget0();
icon1= new QGraphicsWidget1();
scene.addItem(icon0);
scene.addItem(icon1);
icon1->setZValue(-1);

感谢大家的回复,我已经解决了问题,我在一些图标上设置了 QGraphicsItem::ItemStacksBehindParent,导致其他图标看起来 setZValue() 不起作用。