![]() |
Home · Examples |
When building embedded applications on low-powered devices, Qt for Embedded Linux provides a number of options that reduce the memory and/or CPU requirements by making various trade-offs. These options range from variations in programming style, to linking and memory allocation.
But note that the most direct way of saving resources, is to avoid compiling in features that are not required. See the fine tuning features documentation for details.
This improves the start-up time and reduces memory usage at the expense of flexibility (to add a new application, you must recompile the single executable) and robustness (if one application has a bug, it might harm other applications).
Creating a Static Build To compile Qt as a static library, use the -static option when running configure: ./configure -staticTo build the application suite as an all-in-one application, design each application as a stand-alone widget (or set of widgets) with only minimal code in the main() function. Then, write an application that provides a means of switching between the applications. The Qt Extended platform is an example using this approach: It can be built either as a set of dynamically linked executables, or as a single static application. Note that the application still should link dynamically against the standard C library and any other libraries which might be used by other applications on the target device. |
void *operator new[](size_t size) { return malloc(size); } void *operator new(size_t size) { return malloc(size); } void operator delete[](void *ptr) { free(ptr); } void operator delete[](void *ptr, size_t) { free(ptr); } void operator delete(void *ptr) { free(ptr); } void operator delete(void *ptr, size_t) { free(ptr); }The example above shows the necessary code to switch to the plain C memory allocators.
The default behavior is for each client to render its widgets into memory while the server is responsible for putting the contents of the memory onto the screen. But when the hardware is known and well defined, as is often the case with software for embedded devices, it might be useful to bypass the backing store, allowing the clients to manipulate the underlying hardware directly. There are two approaches to direct painting: The first approach is to set the Qt::WA_PaintOnScreen window attribute for each widget, the other is to use the QDirectPainter class to reserve a region of the framebuffer. For more information, see the direct painting section of the architecture documentation.
Copyright © 2008 Nokia | Trademarks | Qt Jambi 4.4.3_01 |