×
Namespaces

Variants
Actions
(Difference between revisions)

Porting iPhone Web Apps to Qt using QtWebKit

From Nokia Developer Wiki
Jump to: navigation, search
chintandave_er (Talk | contribs)
(Porting iPhone Web Apps to Qt using QtWebKit)
 
chintandave_er (Talk | contribs)
m
Line 107: Line 107:
 
</code>
 
</code>
  
==Screen shot==
+
==http://wiki.forum.nokia.com/index.php/Porting_iPhone_Web_Apps_to_Qt_using_QtWebKit==
 
Here is one ported iPhone web app screen snap.  
 
Here is one ported iPhone web app screen snap.  
  
Line 113: Line 113:
  
  
==Postconditions==
+
==Source Code==
  
 
You can download source code from this link [[File:WebApp.zip]]
 
You can download source code from this link [[File:WebApp.zip]]

Revision as of 23:31, 13 November 2010

Template:KBCS

Article Metadata
Tested with
Devices(s): Nokia 5800, N900
Compatibility
Platform(s): S60, Symbian^3, Maemo
Article
Keywords: Web, WebKit, HTML, QWebView, JavaScript
Created: (15 Nov 2010)
Last edited: chintandave_er (13 Nov 2010)

Contents

Overview

This Wiki Article shows how to port iPhone Web Apps to Qt using QtWebkit.

Install the Nokia Qt SDK

Install Nokia Qt SDK if you don’t already have it from here.

Main Class

#include <QtGui/QApplication>
#include "webapp.h"
 
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
WebApp w;
 
w.showFullScreen();
 
return a.exec();
}


Header

#ifndef WEBAPP_H
#define WEBAPP_H
#include <QtCore/QPointer>
#include <QtWebKit/QWebView>
#include <QtWebKit/QWebPage>
#include <QtWebKit/QWebFrame>
#include <QtGui/QWidget>
#include <QtGui/QApplication>
#include <QtGui/QMainWindow>
#include <QtGui/QFrame>
#include <QtGui/QVBoxLayout>
class WebApp : public QMainWindow
{
Q_OBJECT
public:
WebApp(QWidget *parent = 0);
~WebApp();
private:
QPointer<QWebView> _webView;
QPointer<QVBoxLayout> _layout;
void SetupApp();
};
#endif // WEBAPP_H


Source

#include "webapp.h"
WebApp::WebApp(QWidget *parent)
: QMainWindow(parent)
{
SetupApp();
}
WebApp::~WebApp()
{
}
void WebApp::SetupApp()
{
/**
* Create the central widget
* and set it.
*/

QFrame* cW = new QFrame(this);
setCentralWidget(cW);
/**
* Set the layout to central widget.
*/

_layout = new QVBoxLayout(this);
cW->setLayout(_layout);
_layout->setMargin(0);
_layout->setSpacing(0);
/**
* Let's create the web view which
* will be used to display our page.
*/

_webView = new QWebView(this);
 
// Add your iPhone Web App URL to display in Qt App
_webView->load(QUrl("http://URL"));
_webView->show();
/** Add it to layout */
_layout->addWidget(_webView);
}

http://wiki.forum.nokia.com/index.php/Porting_iPhone_Web_Apps_to_Qt_using_QtWebKit

Here is one ported iPhone web app screen snap.

IphoneWebApp.jpg


Source Code

You can download source code from this link File:WebApp.zip

59 page views in the last 30 days.
×