When I try to pass what appears to be a reference to my QPixmap
, I get an error:
error: no matching function for call to ‘QGraphicsScene::addItem(QGraphicsPixmapItem (&)(QPixmap))’
The problem is that I don't know where this reference is coming from, though I'm guessing it's coming from the iterator.
void MainWindow::addItems(std::map<std::string, QString> * items)
{
std::map<std::string, QString>::const_iterator current;
for(current = items->begin(); current != items->end(); ++current)
{
QString cur = current->second;
QGraphicsPixmapItem item(QPixmap(cur));
_scene->addItem(item);
}
}
If that's the case, is there a way to de-reference the iterator
? Otherwise, what is it that I'm doing wrong?
The code which calls it
int main(int argc, char *argv[])
{
std::map<std::string, QString> * items;
items->insert(std::pair<std::string, QString>("ozone", ":/images/ozone_sprite.png"));
QApplication a(argc, argv);
MainWindow window;
window.addItems(items);
window.show();
delete items;
return a.exec();
}