天天看點

模仿QQ Potato 的截圖功能

這個代碼子產品适合用在IM項目中,封裝好性高 耦合性低,直接加到項目使用 隻需要new一個類就可以用了

需要的可以下載下傳哈

widget.h

#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = nullptr);
    ~Widget();

private slots:
    void on_pushButton_clicked();

private:
    Ui::Widget *ui;
};

#endif // WIDGET_H
           

widget.cpp

#include "widget.h"
#include "ui_widget.h"
#include "capturewidget.h"
#include "widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_clicked()
{
    CaptureWidget *CaptureWget = new CaptureWidget(this);
    CaptureWget->show();
    CaptureWget->setFocus();
}
           
模仿QQ Potato 的截圖功能

需要代碼請到此下載下傳 https://download.csdn.net/download/chifandeyu/12431186