KShare/screenshotutil.cpp

23 lines
499 B
C++
Raw Normal View History

2017-04-23 15:05:48 +02:00
#include "screenshotutil.hpp"
#include <QApplication>
#include <QClipboard>
#include <QPixmap>
#include <QScreen>
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) {
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) {
QApplication::clipboard()->setText(value);
2017-04-23 15:05:48 +02:00
}