关闭

win7下Qt5获取桌面截图

391人阅读 评论(0) 收藏 举报
分类:

os:window7

Qt:5.3

//begin:get system desktop and save it as a QPixmap.
    QScreen* screen = QGuiApplication::primaryScreen();
    //return the desktop window(root window).
    QDesktopWidget* desktop = QApplication::desktop();
    //get the geometry size of desktop.
    QRect rect = desktop->screenGeometry();

    //grab the contents of the given window resticted by Wid & QRect.
    mFullScreen = screen->grabWindow(desktop->winId(), 0, 0, rect.width(), rect.height());
    pLabelFullScreen->setPixmap(mFullScreen);
    pLabelFullScreen->showFullScreen();
    //end:get system desktop and save it as a QPixmap.


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:11112次
    • 积分:227
    • 等级:
    • 排名:千里之外
    • 原创:7篇
    • 转载:11篇
    • 译文:0篇
    • 评论:0条
    文章分类