0

当我想抓取整个窗口时,我只能在centralWidget中抓取用OpenGL绘制的东西。

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

我用 QT 绘制的东西,比如 QPixmap 或 QPainter(甚至在 statusBar 中),不能在grabWidget 中显示。

谁能告诉我如何获取整个主窗口,或者ui->OpenGLWidget使用错误?

这是我第一次在 stackoverflow 上提问。如果我的陈述有问题,请随时纠正。

4

1 回答 1

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

于 2021-11-09T08:38:30.167 回答