My favourite software’s opening up at last

Yesterday I read on OSNews that the company behind Qt, the toolkit with which I write all my programs including Catkin, have finally decided to release the Windows version of the software as “open source” – that is, that it’ll be freely available for use by anyone who wants to publish freely available software themselves. In case anyone wonders what I’m talking about (which people probably do), Qt and software like it takes care of the windows and buttons you see in any windowed program. Qt is actually one of the most sophisticated, and developed by a small Norwegian company, unlike Java, which is by Sun Microsystems, a massive and long-established tech company. So it’s been understandably cautious about opening up the version of its only big product for the most popular platform.

Qt has been around since the early 1990s, and is one of two such toolkits which is in common use on Linux systems. It was the cause of a big dispute early in its life, because a large contingent of Linux users come from the GNU community, which invented the General Public Licence as a reaction to the restrictive “Non-Disclosure Agreements” which started appearing in the late 1970s, much to the distress of some long-term programmers. They started writing “free software”, intending to develop a whole operating system, but the software ended up being subsumed into the Linux system, and people who wanted to appeal to the business user started calling it “open source” instead. Originally, Qt was available free of charge for people who wanted to write “free” or “open source” software, but it wasn’t “free” itself.

Qt was popular because it’s so easy to program in for anyone who knows the C++ programming language. There is a page here for anyone wishing to learn how to program for Windows the normal way, and I’m really surprised at how much code is necessary to just display one window on the screen. Note that the code in green is just the author’s comments, not part of the program. But it’s still a fair bit of code, compared to the amount needed to display a simple, blank window in Qt:

#include <qapplication.h>

#include <qwidget.h>

int main( int argc, char *argv[] )
{
  QApplication myapp( argc, argv );

  QWidget *myWidget = new QWidget();
  myWidget->resize( 200, 100 );
  myWidget->setCaption( “Simple window” );

  myapp.setMainWidget( myWidget );
  myWidget->show();
  return myapp.exec();
}

A bit of explanation: anything here beginning with Q is a Qt object: a Qt application, and a Qt “widget” which is anything displayed on the screen. “Main” is the main body of the program; the program is registered with Qt (along with whatever you typed when you ran the program), the widget is established, resized, and a title set. Qt is told that this is the main object – i.e., when it closes, the program is finished. The object (an empty box with a title) is displayed, and then the control is passed to the box, which tells Qt when someone does something with it – in fact, all you can do is close it. After this happens, the program finishes.

You might not have understood the program, but you can obviously see that it takes much less effort than to do the same with Windows’ own programming routines. I’ve seen many such toolkits, and none are as simple as this, with the exception of “Cocoa” which is used on the Mac – and that’s only because, when you initiate any Cocoa programming project, Apple’s programming software gives you that to start with.

Qt has been available on an “open source” basis to Linux and Mac programmers for years. But these two systems combined don’t even approach Microsoft’s share of the computing market. I don’t think it’s mature enough for serious Mac development anyway; a Qt Mac program looks really quite crude compared to Mac-specific software. It works, but it looks, and feels, odd. For years the Windows version of Qt was reserved for commercial licence holders, and commercial licences start at around £1,000 – that’s about $1,800. The full version costs about £500 more, and those prices are just for one programmer. There was a non-commercial version (you had to fork out for a big book to get that, though), which displays “Non-commercial” on every single window. The reason for this is that the company couldn’t find any way to sustain its business model if it gave away the potentially most popular version of the product.

It now seems that they’ve come round to the dual-licensing idea: sell it at a premium to big software houses like Adobe (Photoshop Album is based on Qt), while allowing people who want to write freely-available (mostly smaller-scale) programs to use it freely. That way, the company has a lot more eyes and ears, who can report bugs in the software and suggest changes, and a bigger base of experienced Qt programmers appears, which is of benefit to the big software houses.

But actually, I suspect that the real reason for this development is that Trolltech and its business model have been circumvented. There has long been a package called Cygwin, which allows Linux programs (including the X11 windowing system) to be run on Windows; it’s presently distributed by Red Hat. The geeks have developed a Cygwin version of Qt, which can run the software without the developer having to fork out for a commercial licence. So there’s no point in Trolltech keeping it closed any longer. It’s good news, anyway, for me as a Qt programmer currently confined to the two niche systems (albeit two vastly superior systems). It also means there’s no point in universities foisting Java on students when an easier and better option is available for everyone. Hey IT students – time to learn a proper programming language!

Share

You may also like...