2017-04-23 15:05:48 +02:00
|
|
|
#include "screenshotutil.hpp"
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QClipboard>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QScreen>
|
|
|
|
|
2017-05-09 17:26:00 +02:00
|
|
|
QPixmap *screenshotutil::fullscreen() {
|
|
|
|
return window(0);
|
|
|
|
}
|
2017-04-23 15:05:48 +02:00
|
|
|
|
2017-05-06 13:21:12 +02:00
|
|
|
QPixmap *screenshotutil::window(long wid) {
|
2017-05-09 17:26:00 +02:00
|
|
|
QScreen *w = QApplication::primaryScreen();
|
|
|
|
QPixmap screen = w->grabWindow(wid);
|
|
|
|
QPixmap *pm = new QPixmap(screen.size());
|
|
|
|
screen.swap(*pm);
|
|
|
|
return pm;
|
2017-04-23 15:05:48 +02:00
|
|
|
}
|
|
|
|
|
2017-05-06 13:21:12 +02:00
|
|
|
void screenshotutil::toClipboard(QString value) {
|
2017-05-09 17:26:00 +02:00
|
|
|
QApplication::clipboard()->setText(value);
|
2017-04-23 15:05:48 +02:00
|
|
|
}
|