Michael Hasselmann

Wt - a Qt-ish web toolkit written in C++

First of all, C++ for web apps doesn't necessarily make it easier to write them. Compared to other solutions (let's say Django) you'll end up writing a lot more code. And you have to be very very careful with memory leaks.

But that isn't the point. The main advantage of this framework is how close it is to desktop applications. Porting your Qt desktop application to the web is certainly easier with Wt than with any other solution, as you keep most of the widget API and also the signal and slots paradigm (which should allow to port the app reusing the same business logic as on the desktop).

Also, this is the first time I could attach a powerful debugger, namely gdb, to a web app and debug it is as if it were a normal desktop app. Together with the compiler-guaranteed type safety this is a huge improvement for code robustness.

A toolkit that actually uses C++

There are also some distinct advantages of this toolkit over Qt itself:

Installation

The fastest way is to simply get the source from the git repo and to follow the instructions:

For your own projects make sure to link against all the needed Wt libs: libwt (core), libwtext (if you want to use anything from Wt::Ext, see below), libwthttp (if you want to build apps with inbuilt web server, quite helpful). If you happen to use autotools then you might want to include AC_CHECK_LIB macros into your configure.ac. I had troubles finding non-name-mangled function names, but "$ readelf --dynamic --symbols /path/to/lib/lib.so | grep -v _Z | tail" should help.

ExtJS

Wt wrappes a highly advanced (in terms of bringing desktop UX to the web) Javascript framework - ExtJs. Sadly, it is also big (roughly 80kb have to travel to the client first) and very buggy. It would seem that you could use ExtJS and make it use jQuery instead, perhaps that's worth a try. For now I disabled ExtJS in my little project, since I couldn't debug some of its issues. The Wt-native widgets seem to be quite solid in comparison (even if they look a bit boring).

The installation instructions that come with Wt don't tell you how to install ExtJS, so here is what I found out:

Comments

Koen Deforche commented on November 3, 2009 at 7:50 a.m.

Hey Michael,

Great review of Wt! When you say that you need to write more code with Wt than with Django for a web app, is it because of the database layer, or also for other reasons?

Michael Hasselmann commented on November 3, 2009 at 4:28 p.m.

Koen, it starts with the header files. Of course I don't mind this extra work, as I am quite used to it by now (and actually, it helps a lot, too).

Then, for most of the typical web tasks Django offers reusable solutions that only need very few changes.

With Wt, the tools at hand are modelled for desktop apps. So if there is a problem that could be either solved with a desktop UI or a web UI, I still think a "traditional" web toolkit, with all their duck typing/duck punching stay ahead of the competition. They probably also need less code because they simply don't have to care for correct memory management.

Anyway, I am totally in love with signal and slots for web apps =) It allows me to describe my intended behaviour and the interaction of class instances in much cleaner ways.

Francis Lahaie commented on March 26, 2010 at 5:36 p.m.

Thanks Michael,
for the review especially for ExtJS which is somewhat hard to find out how to integrate with WT. There is only one thing Wt says it only support ExtJS 2.0 or 2.1 not 2.2 or more.
Here's a genuine link
http://www.webtoolkit.eu/wt/doc/refer...

Thanks again