It's Small, Powerful, and Cross Platform
The Image Viewer application is around 150 lines of code (not counting comments), which can be compiled to any of the platforms that Qt supports, and will run natively with the platform's look-and-feel or custom look-and-feel created using style sheets. The application supports three languages and can be run on both desktop computers as well as embedded devices.
Qt provides a powerful layout system that takes care of the repositioning of widgets as an application resizes. That means that problems like dealing with users switching the view orientation from Portrait to Landscape mode, or dealing with different screen resolutions, goes away. This application has no special code for dealing with screens of different sizes or with the switching of view orientationsthis is all handled automatically by Qt. Figure 4 shows the same application running in QVGA and VGA with different view orientations.
Qt, Windows CE, and Visual Studio 2005
To create a native Windows CE application in Visual Studio 2005, you need four things:
- Visual Studio 2005 Standard Edition or better (Express edition cannot be used).
- Windows CE SDK.
- Windows CE emulator image or a Windows CE device.
- Qt for Windows CE.
The Windows CE SDK and emulator are part of the Windows Mobile 5.0 SDK available from Microsoft (www.microsoft.com/downloads/ details.aspx?familyid=83A52AF2-F524-4EC5-9155-717CBE5D25ED). If you already have a Windows CE device, you still need the SDK.
Once you have gotten the four ingredients installed, you can build a native application. The easiest way to build a Qt application is with qmake, a makefile generator that reads a project file and outputs a makefile or project file for the specified platform and compiler. To start your first project, navigate into the demos or examples directory in Qt and have qmake generate a Visual Studio project file for you. For example, navigate to demos\textedit and run:
qmake -tp vc
and open the textedit.vcproj file generated. The Visual Studio project file (.vcproj) has everything set up from include paths to library paths, as well as deployment rules that describe the libraries and resources that should be uploaded to your emulator or device. It simply takes the press of F5 to automatically build, link, and sign the application; deploy to your device; and start the native application you have created.
The really cool thing is that you don't necessarily have to use Windows CE or even Visual Studio when you develop Windows CE apps. Because Qt is cross-platform, you can develop on any supported platform, then just compile for Windows CE using Visual Studio 2005 in the end. Even though Visual Studio 2005 makes embedded development pleasant, it is still faster to debug an application when it's not running in an emulator or on a device. Indeed, I developed most of the Qt Image Viewer under Linux.