I am working on a Linux based embedded system. It uses Qt for windowing and there is no Xserver. My aim is to take screen shot of the screen.
I have tried using FBgrab. It failed since I don't have a /dev/fb0
since the frame buffer is not enabled in the kernel. We are running a Qt based application to show the UI on the screen (HDMI). I have also tried the screen shot application in the QT website which uses QPixmap and grab window. This also is a failure, since I can't run two QAppliction in the system since it affects the display.
Is there any other way to get the screen shot?
You can make your application take a screenshot of itself based on some event or command. You do this by grabbing the widget to a pixmap, and then saving this pixmap somewhere. For example:
QWidget *widget = QApplication::activeWindow();
QPixmap pixmap = QPixmap::grabWidget(widget);
pixmap.save(QString("/path/to/screenshot/screenshot.png"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With