Screenshot de l'IHM

Ici, this est le QWidget à capturer.

QRect rectangle(0, 0, this->width(), this->height());
QPixmap pixmap(rectangle.size());
this->render(&pixmap, QPoint(), QRegion(rectangle));
pixmap.save("screenshot.png");

qt - How to create screenshot of QWidget_ - Stack Overflow Archive le 08/10/2019