Who needs a browser, Qt Jambi just got one?

There is almost always room for a browser in a desktop application. You might need to show some help pages, documents, formated source code, xml or what not. And then you need a browser.

Up to now these browsers have often been limited to show some simple html. But with Qt 4.4 and Qt Jambi 4.4 we will have a proper WebKit integration and voila.. you have a full fledged web browser at your fingertips.

Let's have a quick look at what it can do!

browser1.pngbrowser21.png

Oi, that looks promising.. Let's have a look at the source code to this example that has been written using Qt Jambi.

import com.trolltech.qt.core.*;
import com.trolltech.qt.gui.*;
import com.trolltech.qt.webkit.*;

class HelloWebKit extends QWidget {

private QWebView browser;
private QLineEdit field;

public HelloWebKit() {
field = new QLineEdit();
browser = new QWebView();

QVBoxLayout layout = new QVBoxLayout(this);
layout.addWidget(field);
layout.addWidget(browser);

field.returnPressed.connect(this, "open()");
}

public void open() {
String text = field.text();

if (text.indexOf("://") < 0)
text = "http://" + text;

browser.load(new QUrl(text));
}

public static void main(String args[]) {
QApplication.initialize(args);

HelloWebKit widget = new HelloWebKit();
widget.show();

QApplication.exec();
}
}

That wasn't difficult was it :-) But can this actually render some normal webpages.. yes it can. So here goes another screenshot :-)

browser3.png


Blog Topics:

Comments