PDA

View Full Version : GraphicsItem_cast question



rogerholmes
1st November 2009, 21:40
I am using the code from the Diagram example ,

I want to be able to add pictures to the scene, i ALMOST have it working but i can not figure out how to use a QGraphicspixmapItem with this function. It returns error that QGraphicsmap* can not be converted QGraphicsPixmapItem. how can i do this ?




foreach (QGraphicsItem *item, scene->selectedItems()) {
if (item->type() == DiagramItem::Type) {
qgraphicsitem_cast<DiagramItem *>(item);
}

int x= item->boundingRect().center().x();
int y= item->boundingRect().center().y();
if(ui->rotateButton->isChecked())
{item->setTransform(QTransform().translate(x, y).rotate(-value).translate(-x, -y));db->updateAngle(-value);}
else
{item->setTransform(QTransform().translate(x, y).rotate(value).translate(-x, -y));db->updateAngle(value);}
}

wysota
3rd November 2009, 10:24
What is QGraphicsmap and what is DiagramItem? How is the code you pasted related to the problem? You do realize the whole if block is a no-op, right?