Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

.NET

Qt and Windows CE


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 orientations—this is all handled automatically by Qt. Figure 4 shows the same application running in QVGA and VGA with different view orientations.

[Click image to view at full size]

Figure 4: (a) Qt Image Viewer running in QVGA Portrait; (b) Qt Image Viewer running in VGA Landscape.

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.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.