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);}
}
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);}
}