-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapt.cpp
More file actions
32 lines (26 loc) · 703 Bytes
/
capt.cpp
File metadata and controls
32 lines (26 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "capt.h"
Capt::Capt()
{
this->webView = new QWebView(0);
QObject::connect(this->webView, SIGNAL(loadFinished(bool)), this, SLOT(loaded(bool)));
}
void Capt::save(QUrl url, QString path){
this->path = path;
this->webView->load(url);
}
void Capt::loaded(bool ok){
if(!ok){
return;
}
QWebPage *page = this->webView->page();
page->setViewportSize(QSize(1366, 768));
QWebFrame*frame = page->currentFrame();
page->setViewportSize(frame->contentsSize());
QPainter painter;
QPixmap pixmap(frame->contentsSize());
painter.begin(&pixmap);
frame->render(&painter);
painter.end();
pixmap.save(this->path);
emit exitApp();
}