Ok, but I'm warning you, it's quite strange. So I've commented the problem core lines:
// painter.setRenderHint(QPainter::Antialiasing);
// scene->render(&painter);
// painter.end();
// pixmap.save(QDir::currentPath() + "/statistiche.png");
QPixmap pixmap(endX, endY);
QPainter painter(&pixmap);
// painter.setRenderHint(QPainter::Antialiasing);
// scene->render(&painter);
// painter.end();
// pixmap.save(QDir::currentPath() + "/statistiche.png");
To copy to clipboard, switch view to plain text mode
leaving only the QPainter declaration. That to find which instruction was the problem. And Taaa Daaa line by line I arrived at the end without having the error anymore!!!
I don't know if it depends by the compiler (just a flicker) or my PC but now is working, that's my honest work, believe or not.
Bookmarks