qt截取屏幕

#include<QtCore/QString>
#include<QtGui>
#include<QtGui/QPixmap>
int main(int argc,char* argv[]){
    QApplication app(argc,argv);
    QPixmap pixmap;
    pixmap=pixmap.grabWindow(QApplication::desktop()->winId());
    QString pic;
    pic="aa.jpg";
    pixmap.save(pic, "JPG");
    return app.exec(); 
}
原文地址:https://www.cnblogs.com/gxh973121/p/2716216.html