diff options
Diffstat (limited to 'webkitTest/webkittest.cpp')
| -rw-r--r-- | webkitTest/webkittest.cpp | 58 |
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() +{ + +} + + |
