Unsolved QGraphicsItem setPos() x(),y()=0
-
How to get x,y after addItem ?
It seems first setPos() then can get Pos().
If don not setPos(), pos() = (0,0)....... QGraphicsRectItem *GRI = scene->addRect(x, y, w, h, pen, brush); QGraphicsEllipseItem *GEI = scene->addEllipse(x, y, w, h, pen, brush); QGraphicsTextItem *GTI = scene->addText(text, font); GTI->setPos(QPoint(x,y)); ...... QList<QGraphicsItem*> list_GI = scene->items(Qt::AscendingOrder); for(int i=0; i<list_GI.count(); i++){ qDebug() << list_GI.at(i)->x() << list_GI.at(i)->y(); // 0 0 qDebug() << list_GI.at(i)->width() << list_GI.at(i)->height(); // no these function }
-
Hi,
Do you mean the QGraphicsItem::pos method ?