How to Be Cute on All Desktops with Qt
So far, this discussion has focused only on moving code between different desktops, which is just half of Qt's ambition. Qt comes in three embedded flavors: embedded Linux, Windows CE and Symbian S60.
The Windows CE and S60 ports make it possible to run Qt applications on phones and palmtops. Each of the ports takes the target device's styling into account and integrates the application in a seamless manner. At the time of this writing, the S60 port is available only as a technical preview; a full release is planned later in 2009.
The embedded Linux version makes it possible to run Qt directly on the framebuffer. This greatly reduces the footprint of the system, making it embeddable. The windowing needs are covered by an integrated window manager QWS (Qt Windowing System), but generally, these systems run their applications in full-screen mode.
One interesting feature is the ability to run applications in a virtual framebuffer, making it possible to emulate the correct resolution, bit depth and input behavior on a development machine. This allows you to start developing the software earlier in the project cycle. It also can simplify debugging, as you can avoid remote debugging.
The step when moving from desktop to embedded is generally larger than when moving between desktops or embedded systems. There are a number of issues that a framework cannot solve. The most common issues are available screen space, lack of computing power and lack of memory. All these areas are becoming less of a concern as the power, memory and screen resolution of embedded systems increase.
Qt provides the ability to style and stretch interfaces to fit the screen. You also can set the global strut. This is the minimum size that any user interface element can have. By adjusting this factor, you can tune widgets to make them usable using a finger, stylus or mouse.
Qt provides an API that can be used across a variety of platforms. All major desktops are supported, but also the major embeddable platforms. The strength of Qt is that all these platforms can be reached through one API. The API is provided by one library, one set of goals and one approach to constructing APIs. To take full advantage of Qt's cross-platform ability, you should embrace the use of Qt in all fields. If you do, you can move your code as easy as you can compile it.
Using Platform-Specifics through a Movable API
Qt might provide a cross-platform API that can cover almost all cases, but you still might want to use platform-specific features. For instance, opening the window as maximized in Windows and normal on OS X and X11. To handle these situations, Qt provides preprocessor defines describing on which OS you are running and which windowing system you are using. For example, on Linux, you'll find Q_OS_LINUX and probably Q_WS_X11.
When you know on which system you are running, you can access all X11 events by re-implementing the x11EventFilter function of the QApplication class. On OS X, you can get hold of the CoreGraphics handle from the macCGHandle function of each QWidget.
If you want to avoid writing platform-specific code, you still can give platform-specific hints. For instance, you can give a hint to a QDialog that it is a sheet. This is a dialog that appears inside another window or dialog that provides part of the larger window's features. You do this by setting the window flags of your dialog to Qt::Sheet.
On X11, this type of hint relies on the window manager's ability to understand it. This means the hint must be used as a hint, not a setting. If you want complete control, pass Qt::X11BypassWindowManagerHint. This tries to avoid the window manager completely, which is not a nice thing to do, but might be necessary.
Cross-Platform Development Using a Cross-Platform Environment
Qt comes with a set of tools that can be used separately or from within the fairly new QtCreator application. QtCreator was created using Qt and provides an advanced code editor, documentation, an integrated version of Qt Designer and editors for Qt-specific files, such as project files and resource files.
Because all the Qt tools also are available separately, it is common to use another IDE or just a text editor and command line. Qt Software provides integrations for Microsoft Visual Studio, Xcode and Eclipse. There also are a range of free IDE projects out there, such as Edyuk, QDevelop and KDevelop.
So, what does QtCreator provide that the others don't? First, it comes as a part of the Qt SDK. The SDK version of Qt comes as a single download with a prebuilt version of Qt and QtCreator set up and ready to go. Second, it provides a graphical debugger interface, letting you use gdb in the easiest possible manner across all desktop platforms supported by Qt. The debugger knows of Qt and provides macros for easy viewing of QString objects as well as for looking inside Qt's list classes.
Johan Thelin has worked with software development since 1995 and Qt since 2000. Having seen server-side enterprise software, desktop applications and Web solutions, he now works as a consultant focusing on embedded systems. Johan can be contacted at johan@thelins.se.
Johan Thelin is a consultant working with Qt, embedded and free software. On-line, he is known as e8johan.
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
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- Web & UI Developer (JavaScript & j Query)
- UX Designer
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
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.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




3 hours 18 min ago
9 hours 4 min ago
9 hours 21 min ago
11 hours 14 min ago
13 hours 8 min ago
20 hours 2 min ago
20 hours 18 min ago
22 hours 9 min ago
1 day 4 hours ago
1 day 8 hours ago