I'm trying to group a list of QGraphicsPixmapItems in a QGraphicsScene. However, I see that I can only add lists of QGraphicsItems to the scene. What would be the best way to typecast a list of QGraphicsPixmapItems to a list of QGraphicsItems? Is there a specific way to do this for qt items? Alternatively, is there a better way to add a list of QGraphicsPixmapItems to a scene group?
Just to illustrate the problem, in the code below, I've created 5 blank pixmaps that I'm trying to add.
QGraphicsScene *scene;
QColor whiteColor = QColor(0,0,0,0);
QGraphicsItemGroup * labels;
QList<QGraphicsPixmapItem*> labelItems;
for (int i = 0; i<5; i++)
{
QGraphicsPixmapItem *labtemp = new QGraphicsPixmapItem();
QPixmap labelMap = QPixmap(100,100);
labelMap.fill(whiteColor);
labtemp->setPixmap(labelMap);
labelItems.append(labtemp);
scene->addItem(labelItems[i]);
}
labels = scene->createItemGroup(labelItems);
Any help would be appreciated. Thanks!