找回密码
 立即注册
收起左侧

想问一下grabWindow()函数中WinId是什么意思,scaled怎么使用

0
回复
6897
查看
[复制链接]
累计签到:1 天
连续签到:1 天
来源: 2017-5-3 21:18:01 显示全部楼层 |阅读模式
1Qter豆

#ifndef SCREENPRINT_H#define SCREENPRINT_H
#include <QWidget>#include <QTimer>#include <QMessageBox>#include <QPixmap>#include <QDesktopWidget>
namespace Ui {class ScreenPrint;}
class ScreenPrint : public QWidget{    Q_OBJECT    public:    explicit ScreenPrint(QWidget *parent = 0);    ~ScreenPrint();    private slots:    void on_newprintpushButton_clicked();    void  ShotScreenSlot();
private:    Ui::ScreenPrint *ui;    QTimer  * timer;    QPixmap   pixmap;
};
#endif // SCREENPRINT_H



void
ScreenPrint::ShotScreenSlot(){    this->pixmap=QPixmap::grabWindow(QApplication::desktop()->winId());    ui->printlabel->setPixmap(pixmap.scaled(ui->printlabel->size()));
    this->show();    this->timer->stop();
}

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了