• 4398阅读
  • 4回复

[提问]关于qt截屏之截取第二屏幕 [复制链接]

上一主题 下一主题
 

只看楼主 倒序阅读 楼主  发表于: 2015-03-06
如题,目前会用qt截取主屏幕,
QDesktopWidget *desk = QApplication::desktop();
QPixmap fullScreenPixmap = QPixmap::grabWindow(desk->winId());
但是我现在需要用主屏幕截取扩展后的第二屏幕,并且exe显示在主屏幕上,请问代码应该怎么写?
谢谢!!!
无舍不得。
离线roywillow

只看该作者 1楼 发表于: 2015-03-06
这个截取的是所有屏幕的还是主屏幕?或许看看QScreen能获得些帮助?
专业维修核潜艇,回收二手航母、二手航天飞机,大修核反应堆,拆洗导弹发动机更换机油,无人侦察机手动挡改自动,航天飞机保养换三滤,飞碟外太空年检 ,各型号导弹加装迎宾踏板,高空作业擦洗卫星表面除尘、打蜡及抛光,东风全系列巡航导弹。并提供原子对撞机。量大从优,有正规发票。

只看该作者 2楼 发表于: 2015-03-07
目前想了个替代方法,就是将主显示器和第二屏幕对调,所以现在电脑就是第二屏幕了,然后就可以用如上程序截取外接的投影仪(现在是主显示器)上的画面,在电脑上运行程序就可以截到投影仪上的画面了。
不过要是直接qt程序能编出来肯定更好!继续征解啊!!!谢谢!!!
无舍不得。
离线clearsky

只看该作者 3楼 发表于: 2015-03-07
参考:
QWidget * QDesktopWidget::​screen(int screen = -1)
Returns a widget that represents the screen with index screen (a value of -1 means the default screen).

If the system uses a virtual desktop, the returned widget will have the geometry of the entire virtual desktop; i.e., bounding every screen.
渴望  晴朗的天空

只看该作者 4楼 发表于: 2015-03-08
回 clearsky 的帖子
clearsky:参考:
QWidget * QDesktopWidget::​screen(int screen = -1)
Returns a widget that represents the screen with index screen (a value of -1 means the default screen).
If the system uses a virtual desktop, the returned widget will have the geometry of the ent .. (2015-03-07 22:58) 

我算出来的Screencount()一直都是2,但是只能知道主屏的编号为0,不知道第二屏幕的编号是多少,引用不了啊
无舍不得。
快速回复
限100 字节
 
上一个 下一个