In this example, you can get the whole screen of widgets. You can attach this method to any keystroke or waveform, as you prefer, to take a consistent screen shot.
MyClass::screenshot() { QWidget *w = QApplication::activeWindow(); if(w) { static int count = 0; QPixmap p = QPixmap::grabWidget(w); p.save(QString("/your/path/screenshot%1.png").arg(count)); count++; } }
source share