0

When I want to grab the whole window, I can only grab what is drawed with OpenGL in centralWidget.

QPixmap my_pixmap = QPixmap::grabWidget(ui->OpenGLWidget, 0, 0, frameto264.iWidth, frameto264.iHeigth);

What I have draw with QT, like QPixmap or QPainter(or even in statusBar), cant not be showed in grabWidget.

Can anyone tell me how to grab the whole mainwindow, or was the ui->OpenGLWidget using wrong?

It is my first time asking question on stackoverflow. If there is something wrong with my statement, please be free to correct it.

1 Answers1

0

You are capturing the opengl only because that is what you are giving as parameter to the method grabWidget here:

QPixmap::grabWidget(ui->OpenGLWidget....

Instead of doing

grabWidget(ui->OpenGLWidget,...

repalce the pointer to your openGl widget by a pointer to the mainWindow

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97
  • I changed the code :```QPixmap::grabWidget(this,....``` in the class mainwindow, but I still can not grab the whole mainwindow. Plus, the screen I grabed turned into green. Is there anything else I can do? Or do I changed code wrong? – Jeff Xiang Nov 10 '21 at 07:23