void locWmGlDisplay::snapshotToClipboard() { paintGL(); // Redraw the scene in case it needs to be updated. QClipboard *cb = QApplication::clipboard(); // get the clipboard QImage tempPicture(this->grabFrameBuffer(false)); // grab current image cb->setImage(tempPicture); // put current image on the clipboard. }
void GLDisplay::snapshotToFile() { paintGL(); // Redraw the scene in case it needs to be updated. QImage tempPicture(this->grabFrameBuffer(false)); // grab current image //save image to file stringstream fileName (stringstream::in|stringstream::out); fileName << "camera_image" << imageCount << ".png"; imageCount++; tempPicture.save(fileName.str().c_str()); //tempPicture.save("camera_image.png"); }