blob: 87e054b01bccc12439d1e640ed71f177e0e299a1 (
plain) (
blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include "fbbrowser.h"
#include <QtGui>
#include <QtWebKit>
#include <QApplication>
fbbrowser::fbbrowser(const QUrl & url)
{
view = new QWebView(this);
view->load(url);
//remove the window decoration
this->setWindowFlags(Qt::SplashScreen);
//enable JavaScript access to qt objects
QObject::connect(view->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJSObject()));
//set form to fullscreen
this->showFullScreen();
setCentralWidget(view);
}
fbbrowser::~fbbrowser()
{
}
void fbbrowser::addJSObject()
{
view->page()->mainFrame()->addToJavaScriptWindowObject(QString("webkitTest"), this);
}
void fbbrowser::writeText(QString text)
{
QFile file("out.txt");
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
return;
QTextStream out(&file);
out << text << "\n";
}
void fbbrowser::quitAll()
{
//emit lastWindowClosed();
}
|