summaryrefslogtreecommitdiffstats
path: root/webkitTest/webkittest.cpp
diff options
context:
space:
mode:
authorNiklas Goby2011-01-11 17:12:03 +0100
committerNiklas Goby2011-01-11 17:12:03 +0100
commitde751b500e635ea4c102a7c9bde442a45667b264 (patch)
tree32c799051ae526018a79df877ef9a75017221ff5 /webkitTest/webkittest.cpp
parentinitial import (diff)
downloadfbgui-de751b500e635ea4c102a7c9bde442a45667b264.tar.gz
fbgui-de751b500e635ea4c102a7c9bde442a45667b264.tar.xz
fbgui-de751b500e635ea4c102a7c9bde442a45667b264.zip
der bisherige stand der dinge
Diffstat (limited to 'webkitTest/webkittest.cpp')
-rw-r--r--webkitTest/webkittest.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/webkitTest/webkittest.cpp b/webkitTest/webkittest.cpp
new file mode 100644
index 0000000..c8d460d
--- /dev/null
+++ b/webkitTest/webkittest.cpp
@@ -0,0 +1,58 @@
+#include <QtGui>
+#include <QtWebKit>
+#include <QFile> //needed for In/Output
+#include "webkittest.h"
+
+webkitTest::webkitTest(QWidget *parent, QUrl & url)
+ : QWidget(parent)
+{
+ ui.setupUi(this);
+ this->url = url;
+ //define starting page
+ ui.webView->load(this->url); //QUrl("http://132.230.4.3/webkitTest.html")
+ ui.webView->show();
+
+ //enable JavaScript access to qt objects
+ QObject::connect(ui.webView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJSObject()));
+
+ //remove the window decoration
+ Qt::WindowFlags flags = Qt::SplashScreen;
+ this->setWindowFlags(flags);
+
+ //set form to fullscreen
+ this->showFullScreen();
+
+ //set webView to the same size as the form
+ ui.webView->resize(this->size());
+
+}
+
+
+//enable JavaScript access to qt objects
+void webkitTest::addJSObject() {
+ ui.webView->page()->mainFrame()->addToJavaScriptWindowObject(QString("webkitTest"), this);
+}
+
+void webkitTest::writeText(QString text){
+ QFile file("out.txt");
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+ return;
+
+ QTextStream out(&file);
+ out << text << "\n";
+}
+/*
+void webkitTest::setQApplication(const QApplication & app){
+
+}
+*/
+void webkitTest::setUrl(QUrl & url){
+ this->url = url;
+}
+
+webkitTest::~webkitTest()
+{
+
+}
+
+