Home > Enterprise >  Qt Insert two different QGraphicsWidgets in the same QGraphicsScene, setZValue is invalid [closed]
Qt Insert two different QGraphicsWidgets in the same QGraphicsScene, setZValue is invalid [closed]

Time:09-30

Calling collidingItems when two QGraphicsWidgets are visible overlapping, but returns null

QGraphicsWidget0, QGraphicsWidget1 inherit from QGraphicsWidget. Eventually I see that icon1 is shown on top, how can I get icon1 to show on the bottom without changing the insertion order?

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

CodePudding user response:

Thanks for the replies guys, I have solved the problem, I had set QGraphicsItem::ItemStacksBehindParent on some icons causing the other icons to look like setZValue() was not working.

  •  Tags:  
  • c qt
  • Related