forrestfsu
24th October 2006, 21:25
I am trying to create a QGraphicsEllipseItem that is shown stacked on top of all other elements (because it is the newest one created). I don't understand why the following is not working by using the "setZValue" function. Is there a way to just make it go on top of all other scene elements because it's the newest? Thanks!
QGraphicsItemGroup *group;
group = new QGraphicsItemGroup();
QGraphicsEllipseItem *tmp;
tmp = scene->addEllipse(QRectF(x, y, 10, 10));
tmp->setPen(pen);
tmp->setBrush(brush);
tmp->setZValue(1000.0);
group->addToGroup(tmp);
I noticed that when I comment out the last line "group->addToGroup(tmp);" the setZValue seems to work. Any input would be super.
QGraphicsItemGroup *group;
group = new QGraphicsItemGroup();
QGraphicsEllipseItem *tmp;
tmp = scene->addEllipse(QRectF(x, y, 10, 10));
tmp->setPen(pen);
tmp->setBrush(brush);
tmp->setZValue(1000.0);
group->addToGroup(tmp);
I noticed that when I comment out the last line "group->addToGroup(tmp);" the setZValue seems to work. Any input would be super.