The next page shows 11 lines of code to create a button that exits the app when pushed.

When I first started reading this book while waiting for my dinner to arrive, I thought to myself, this Qt thing is right up my alley. And this book is also right up my alley, the pragmatic, no nonsense introduction to a pragmatic, no-nonsense C++ application framework. There’s a reason why it is required reading for new hires at Nokia….

Best of all, it’s FREE! Published under the Open Publication License, it is perfectly legal to distribute. It’s currently hosted on the dcsoft.com website here: download, but no guarantees if I will have to take it down if my bandwidth gets used up! You can always download the torrent. But it’s such a good read, I recommend you purchase a hard copy.

Edit April 25, 2009: The book’s source code is available for download from InformIt.

(NOTE: This post was originally published on Mar 06, 2009. It was subsequently moved to the wordpress.com blog service and updated reflect the many comments. Thank you for contributing your comments!

QT IS NOW RELEASED UNDER LPGL

Qt is a cross platform GUI toolkit which was acquired from Trolltech by Nokia. Starting with Qt 4.5, it is dual-licensed under both LPGL and Commercial. The Commercial license can be a bit pricey, but the LPGL license means you can use it free of charge to develop proprietary, commercial, closed-source software. Instantly, Qt has become available to a wide audience of software developers (DCSoft included). Thank you Nokia!

More than a year ago, DCSoft has become very interested in Qt. Much as we love MFC, it hasn’t changed much since 1999, and this is 2009. Qt is easy to learn given its concise syntax and documentation, plugs into Visual Studio (more below), comes with a supported toolset including Designer (a resource editor), Linguist (a localization tool), and Qt Creator (an IDE), giving Qt more momentum than MFC, and a higher performance alternative to .NET. It’s easily one of the best ways to create Windows apps, never mind it can also target Mac, Linux, and several embedded devices.

Starting with Qt 4.6, the LPGL version now comes pre-built for Visual Studio 2008 RTM. If this fits your need, you can simply install it and skip to INSTALL VISUAL STUDIO ADD-IN. However, you will need to build Qt yourself if:

You are using VS 2008 and you have installed SP1 and/or the ATL Security Update, and you are building your app with the _BIND_TO_CURRENT_VCLIBS_VERSION defined (or another means to specify the non-RTM version). This is because both Qt and your app need to be built with the same version of the Visual Studio redistributables, and Qt has been built with RTM, but your app is not being built with RTM.

You are using any version of VS 2005. This is because Qt does not come prebuilt for VS 2005.

Here’s how to get our favorite IDE (Visual Studio 2005/2008) working with Qt!

DOWNLOAD QT SOURCE CODE

As the option to download only the Qt source code is a bit obfuscated on the current Nokia website, please follow these directions:

Run Configure with no parameters to see a help screen. Configure generates nmake compatible makefiles to build all the Qt DLL’s, tools, and demos.

4. Run nmake to build.

c:\qt\4.6.1-vc> nmake

It will take awhile, but this grinds through building the specified Qt DLL’s, tools, and demos with Visual Studio.

INSTALL VISUAL STUDIO ADD-IN

The Qt Visual Studio Add-in is indispensible for developing Qt apps in Visual Studio. The Add-in has replaced the previous Qt Visual Studio Integration, which was only available to Commercial customers. Now the Add-in is used by both LPGL and Commercial licensees, and the Integration has been deprecated. While the Add-in does not allow integrated .ui editing (it instead launches Qt Designer to edit .ui files), it is fully supported and maintained by Nokia, whereas the Integration hadn’t been modified since the 4.3/4.4 timeframe.

Because Visual Studio Express does not allow add-ins, using these free versions of Visual Studio is not recommended for Qt development. You need at least Visual Studio Standard (Pro, Team System, etc. of course will also work).

1. Download and install the Qt Visual Studio Add-in to install the Qt plug-in into Visual Studio (both 2005 and 2008 are supported by the add-in).

2. Start Visual Studio.

3. Select menu Qt | Configure Qt Versions. Add c:\qt\4.6.1-vc.

4. Now Qt is fully functional, and you can use VS2005/2008 to build Qt apps.