Choosing a GUI Library for Your Embedded Device
I will not go into detail about the implementation of my application, as it is not within the scope of this article. However, to summarize, Qtopia is C++-based, and I think the Qtopia designers have a good grasp of the idea of C++. As is no surprise, all widgets are objects, and to have standard functions (methods) in your own widgets (defined in your own class), you inherit from base classes.
The different objects (widgets) need to communicate. For example, if I click on a button, the button object might want to tell the text field object to update the text. In Qt, and thereby Qtopia, this is done using signals and slots. They are simply standard methods with an attribute. This interface makes it possible to make the objects independent of each other. The button just sends a signal, “clicked”, the text object has a slot “update”, and they compile and work fine without each other. Then, when I put them together in my app and give the connect (obj1, clicked, obj2, update) command in the initialization to connect signal clicked with slot update, the magic happens. The text is updated when I click the button.
Those connections even can be made automatically, simply by giving them the right name. If I have a widget named cancelBtn, with the signal clicked, and I make a slot named on_cancelBtn_clicked, the clicked signal from the cancelBtn is automagically connected to this slot. This signal/slot design makes the code easy to read and maintain. On the other hand, if you are not familiar with signals and slots, and you look at someone else's code, you can go on a wild goose chase looking for the calling of the slot (method) for a long time.
So far, the documentation has been a great help. They have done a great job writing the documentation of the API. However, the API documentation does not help you if you don't know what API call you should use for a task. I spent a lot of time making the drawing object work correctly, because I had to collect the information from different places in the documentation. I never found an efficient way to make my scrolling graph. I did not find any bitmap manipulation that would scroll my heartbeat graph, so I chose to repaint the whole thing for every scroll step. There might be an easier way, but I did not find it.
Therefore, if you want to do more advanced programming in Qtopia, you need to find a good book or guide to complement the API documentation.
Nano-X was formerly known as Microwindows. Why the change of name? Take a wild guess. If your guess includes a lawyer, you are probably on the right track.
Nano-X is an open-source project at Nano-X.org, started and still headed by Greg Haerr. Nano-X is licensed under the MPL license. The MPL license allows you to create closed source drivers and applications. But, the Nano-X source itself must stay open. There is an option to use the GPL license, if desired.
The Linux package from Mechatronic Brick includes the Nano-X library, but this version did not include support for PNG pictures. I needed PNG support, so I had to recompile. This was quite easy after I found out what config file is used when building in the Mechatronic Brick setup. I noticed that Nano-X comes with a config file that set up Nano-X to be built with TCC, a small and very fast C-only compiler. I decided to use this too, and then the library was compiling in no time.
Starting to program in Nano-X is quite a change, especially when coming from the nice and polished C++ classes of Qtopia. Nano-X is so much simpler, which leaves a lot more work for the application programmer.
Nano-X does not have widgets, or buttons or combo boxes—only windows. There are libraries to put on top of Nano-X that will give you more features, such as Nano-X's own reimplementation of the win32 library and the Fast Light Toolkit (FLTK). In this article, we delve into the basic part of Nano-X.
Basically, when programming for Nano-X, you do four things:
Create windows.
Paint in the windows.
Select event types for each window.
Wait for an event (the event loop).
A typical standard application window is made of a base window with the frames and the small x close button (of course, there are options to customize this look). Subwindows act as buttons and display fields. Yes, in Nano-X, a button is declared like a subwindow with the mouse-click event selected.
In Qtopia, I simply made a class, connected some signals and slots, and puff, the magic happened. In Nano-X, I had to take care of things myself. A central part of a Nano-X application is the event loop, typically a for (ever) loop containing the get event function and a case structure to handle the event (see Listing 1 for an example). When I get a mouse-click event, I ask which window captured this event and act from that. This means that the single button is not isolated in its own piece of code, but weaves into the app. The basic function of the button or the display field should of course be in a function by itself, but the event loop must be aware of which events are selected in the button and what to do with the events.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
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.
Sponsored by ActiveState
| Non-Linux FOSS: libnotify, OS X Style | Jun 18, 2013 |
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
| Introduction to MapReduce with Hadoop on Linux | Jun 05, 2013 |
- Containers—Not Virtual Machines—Are the Future Cloud
- Non-Linux FOSS: libnotify, OS X Style
- Linux Systems Administrator
- Validate an E-Mail Address with PHP, the Right Way
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Introduction to MapReduce with Hadoop on Linux
- RSS Feeds
- One advantage with VMs
1 hour 18 min ago - about info
1 hour 52 min ago - info
1 hour 52 min ago - info
1 hour 53 min ago - info
1 hour 55 min ago - info
1 hour 57 min ago - abut info
1 hour 58 min ago - info
1 hour 59 min ago - info
2 hours 1 min ago - info
2 hours 2 min ago





Comments
Library for heartbeat graphic
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
Has anyone an example code for a graph that is updated continiously?
using Nano-X
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
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
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
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?
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?
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
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
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
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
"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
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
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