Ok, but I'm warning you, it's quite strange. So I've commented the problem core lines:

Qt Code:
  1. QPixmap pixmap(endX, endY);
  2. QPainter painter(&pixmap);
  3. // painter.setRenderHint(QPainter::Antialiasing);
  4. // scene->render(&painter);
  5. // painter.end();
  6. // 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.