Yes, you can configure state transitions for a call QWidget::grab, then save it to a file through QPixmap.
If you need an example of how to set up the code for the call QWidget::grab, look at this answer: How to make ScreenShot Qt / QML
QPixmap::grabWidget QWidget::grab, QPixmap::grabWidget . QPixmap QWidget::grab, QPixmap, , jpeg, png, gif.
, .
QWidget:: grab
QPixmap
QPixmap:: save