screenshot
-
@jeremy_k Thank you for your reply. Let me describe my device environment information:
1.The version of Qt is 5.14.2
-
I use the eglfs platform plugin
-
The embedded device model I am using is RK3568
The image I built using the buildroot tool has a Linux kernel version of 4.19.206
I also have 2 questions to consult with you
1.What components of Qt do QScreen require to support? (Is it because I am missing the corresponding dynamic library component?)
- Do I need driver layer support to use the QScreen class? (Does the driver layer require corresponding famerbuffer read back support?)
-
-
-
@NanLi geometry dash world said in screenshot
:I made a mistake and the actual debugging was due to
QPixmap pixmap=screen ->grabWindow (0);
Pixmap. isNull()==true
So why does screen ->grabWindow (0) return null.
The reason screen->grabWindow(0) returns null is because it is trying to grab the contents of the entire screen, but the screen is not currently visible. This could be because the screen is not being displayed, or because it is being obscured by another window.
To fix this problem, you need to make sure that the screen is visible before you call grabWindow(). You can do this by calling show() on the screen object.
QScreen *screen = QGuiApplication::primaryScreen(); screen->show(); QPixmap pixmap = screen->grabWindow(0); if (pixmap.isNull()) { // Handle the error }
This code will first show the screen, and then it will grab the contents of the screen and store them in the pixmap variable. If the pixmap variable is null, then there was an error grabbing the screen contents.