Choosing a GUI Library for Your Embedded Device

Evaluating two very different GUI libraries, Qtopia and Nano-X.

In this article, we look at two GUI libraries, examine the differences and give some advice on when to choose each.

The company I work for is dedicated to helping customers make the right decision about the technology they want to use in their embedded software development, and afterward it supports them in using the chosen technology. My specialty is embedded Linux.

Talking with customers, I see that more and more products need some sort of graphical display. So, I decided it was time to gain more knowledge about GUI development on embedded Linux.

The path I chose was the practical one. I did some research and found that the most common libraries are Qtopia (also known as Qt embedded) and Nano-X (formerly known as Microwindows).

How to Test

The first solution is simply to implement some test app to demonstrate the two GUI libs. Such “test apps” only seldom resemble a real-world application, but I do this mostly because I am an engineer, and engineers are more interested in the technology beneath than in the appearance.

“Then why have an engineer test the libraries?”, you might ask. Well, think of GUI libraries as the technology to make an appearance. Therefore, you need both the technology view and the appearance view.

Another aspect of me doing this test is that I am not involved in any of the projects, and therefore I come with the knowledge that most other programmers have when they start out using the libraries. Some of my choices regarding the implementation probably are not optimal. They are made from the information available to the common user of the library—such as the problem with the scrolling graph, discussed below.

So, before ranting at me about how I could have done things differently, please look in the docs. Are they clear about the matter? If not, maybe it is better to change the docs instead.

I decided to get some external inspiration and went to the nearby university, where they have a department educating in User Centered Design (UCD). I asked one of the students, Esti Utami Handarini Povlsen (who was an old friend of mine), to come up with a GUI specification that I would then implement, using the two libraries. After having calibrated our technical language so we could communicate, we found a suitable design that I took to my home to implement.

The design that I got was for a Personal Mobile Medical Device (PMMD). The design consists of a single window with some static buttons and a changing display area showing text and/or graphs.

It turns out that the most challenging part is the heartbeat monitor graph, which is a varying line scrolling across the screen.

The Target Device

The platform I used for the evaluation is the MIPS32-based mb1100 from Mechatronic Brick. The mb1100 development kit is equipped with an AMD Alchemy au1100 CPU, a 6.5" TFT screen, an ADS7846E four-wire touch screen, 32MB of RAM and 32MB of Flash.

Qtopia

I started out with the Qtopia library. The creator of Qtopia is the Norwegian company Trolltech. Trolltech is mostly known for its Qt library on desktop computers; Qt is the base GUI of KDE. Qtopia is the embedded version of the Qt library.

Both Qt and Qtopia are dual-licensed, under the GPL and a commercial license. You can download the GPL version from the Trolltech Web site and use it as any other GPL library. This forces your Qt/Qtopia applications to go under the GPL too. You also can choose to buy the commercial license, which allows you to make closed source applications. The differences between the two versions are minor, if any, except of course for the licenses.

Getting It Up and Running

Qtopia can run directly on the framebuffer device, so make sure that the kernel is compiled with framebuffer support and that it is working.

That is the easy part. The difficult part is making the touch screen work. After having corrected a few glitches in the driver, I had a lot of trouble calibrating the device in Qtopia.

I am using Qtopia with tslib for the touch screen, and after having corrected the driver, tslib was working, and the little calibration program included in the tslib package calibrated well. Drawing lines with the pen in the same program worked fine. After starting a Qtopia program, the calibration was gone, and I tried the calibration program from the Qtopia package with no luck.

I found the error when looking in the sources of Qtopia and tslib. When tslib starts up, it looks into a file in /etc. This file tells tslib what modules to load, and those modules usually include the linearization module and different noise filters.

The linear module is the one that does the calibration. When looking in the sources of Qtopia, I found that the programmer wanted to make sure that the linear module was loaded, so after parsing the tslib config file, Qtopia loads the linear module, regardless of what is written in the config file. This means that if the linear module is defined in the config file, it is loaded twice, and this breaks the functionality. Having figured this out, I removed the linear module from the config file. (I know the correct solution would be to correct the Qtopia sources, but I took the shortcut.) Now the calibration worked in Qtopia.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Library for heartbeat graphic

Claudia Rodriguez's picture

Nice article! I'm working right now in some projects with Qt Embedded and it's been good so far, but I'm curious about what specific library did you use to graph the heartbeat with Qtopia.

The only thing I've found that can make anything like this is a library called QWT which is not included in the Qt package.

Thanks!

Has anyone an example code

Ben's picture

Has anyone an example code for a graph that is updated continiously?

using Nano-X

Vladimir's picture

Using Nano-X is a real headache. Documentation is not good. Though we have no better solution for uClinux we are using in our project (another option is Framebuffer, he-he).
E.g. it's quite unobvious how to setup a regional-specific font.

You have to look into the sources all the time.

Linux, frame buffer, embedded

Venkat's picture

This is a nice start article for business and technical people also. This provides the first feel of the technology and the information.

Nano-X

Sören Wellhöfer's picture

Nano-X is indeed very small and basic but this is exactly why I think it's so worthwhile using it.

Many things can be implemented using simpler means and one has no difficulty looking directly at the Nano-X source code to get a grasp on how things are done there; an insight can be easily gained. I think this gives a developer more freedom of choice how to get things implemented in his own way - at least to some extend.

Also, another advantage arises in my opinion from the conceptual closeness of Nano-X to X. Nano-X might have nothing to do with X11 in any way, however, porting applications that use Xlib by design is very much feasible.

Although it is true that Nano-X lacks widgets to be natively used, there is an extension called TinyWidgets that builds on top of the Nano-X library. In addition to providing most of the elements of a modern graphical user interface it does also come with a graphical designer which I have found helpful so far for my work with Nano-X.

Cheers,
Sören

Correction

samsung's picture

A good effort indeed !
May i note that Qtopia is NOT the embedded version of QT.
Qt library comes in many flavors, mainly for Desktop(development purpose) called Qt/X11 and Embedded(OSrc version for embedded systems) called Qt/Emb. Qt library makes use of the Frame buffer and Input devices.
Now comes Qtopia. It is more of a server (Palmtop-Environment UI for embedded systems) than a library, which runs _above_ the Qt/Emb(or Qt/X11 with Virtual Framebuffer on a development PC). In a way, Qtopia is itself an application making use of the underslying Qt library.
When you write applications for the final GUI, you usually use Qtopia headers and libraries(which in turn makes use of functions in Qt library).

By the way, i wonder why was OPIE(Open Palmtop Integrated Environment) not worth comparing in this study?

.

which Nano-X?

Marc Lindahl's picture

I found two on a web search:

http://www.microwindows.org/

http://embedded.centurysoftware.com/docs/nx/index.html

you're clearly writing about the first one, but what's up with the second one??

RE: which Nano-X?

Martin Hansen's picture

It's the same. centurysoftware is run by Greg Haerr, who is also the main force behind Nano-x, the Nano-X SDK mentioned in your second link is pretty much outdated and abandoned.

Qtopia more then a GUI

Anonymous's picture

Very good article, but I think you should mention that Qtopia Core is more then a GUI, it is an application framework. with a complete set of classes for things such as:

Session Management
Does your application need to save and restore settings, Qtopia hs this built in

Sockets:
Does your app need to talk to a server. or maybe be a server. QSockets(UDP & TCP) and QTcpServer are nifty classes for doing this.

Threads:
Do you need to do a heavy process outside the GUI thread, QThreads will aid here, and most classes in Qtopia are now thread safe

Database:
Qt comes with SQLite built in, and of course can talk to almost all major databases

Data Serialization
If you send data to and from other devices QT will take care of little endian/ big endian. All objects are easy to serialize with QDataStream

International
Do you need to support more then one language. Qtopia comes with a tool called Linguist which allows you to add multi language support without additional programing. It also supports Asian charactor sets as well as manages right to left languages in every GUI widget

Pixmap Management
Need to use something like a cancel pixmap in more then one location. Qtopia apps will cache pixmaps so they get stored once no matter how many places you use them. QImage and QPixmaps work hand in hand so images can be scaled on depending how they are to be used.

Interprocess Communication
QDbus makes it very easy for apps to talk to other Qtopia apps.

Themes
Want to have multiple looks for your display, perhaps a daytime display and a night time display. QTheme makes this very easy to do

Focus on the GUI

Martin Hansen's picture

I could have mentioned a lot of things, but as i was writing an article and not a book I had a limit on space, and then some things is left out.

nice sales pitch

Marc Lindahl's picture

nice to see trolltech salesmen trolling :)

don't forget to mention - the commercial embedded license for QT is ridiculously expensive.

wxWidgets is a viable route for a commercial product - LGPL.

scrolling a widget

Anonymous's picture

"In Qtopia, I simply made a class, connected some signals and slots, and puff, the magic happened."

:) As for the scolling I check out the scroll function in QWidget. It is probably what you are looking for.

http://doc.trolltech.com/4.2/qwidget.html#scroll-2

Available browsers on these two GUI systems

Marco Wang's picture

It's nice to compare the these two windowing system on embedded systems. But IMO there are two major parts are missed in this article: software ported on these two systems and what kind of browser these two GUI systems support respectively. For example, besides Mozilla based browsers, is there a browser can run on Nano-X with Javascript capability?

Maybe You think of internet

Martin Hansenn's picture

Maybe You think of internet tablets like the Nokia 770. But most of my customers do not have the need for a browser, they need a GUI specific for their device most often with no desktop.

And yes i would have liked to dive into the software availiable on the two platforms. And I would also have liked to research more on the add on libraries, that You can put on top of Nano-x to give you the buttons, textpads a.s.o. that you have in QTopia, but I had to set the limit somewhere or I would still be writing on the article.

Regards Martin

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState