Capture multiple screens desktop image using Qt4

后端 未结 4 1302
小鲜肉
小鲜肉 2021-02-06 11:49

i am writing a screen capture application in Qt4 with c++. I have a problem when tuning on dual screens. I am unable to get an image with the second screen. I tried a c# applica

4条回答
  •  情歌与酒
    2021-02-06 12:47

    With a virtual desktop, the QPixmap::grabWindow method seems to return a screenshot with the size of the primary screen. Passing in the dimensions of the full virtual desktop returns a screenshot of both monitors;

      QDesktopWidget *desktop = QApplication::desktop();
      QPixmap screenshot = QPixmap::grabWindow(desktop->winId(), 0, 0, desktop->width(), desktop->height());
    

    Yet to test this behaviour on a Unix / Mac box, but it works under Windows 7.

提交回复
热议问题