Qt: Stangely pronounced, refreshingly useful
Spent some time writing a post on a problem I ran into at work. Nothing too complicated, but it’s solution wasn’t documented very clearly. It’s pretty close to done, however it seemed a bit of a non sequitur to suddenly jump into specifics without some minimum amount of context. Today I’d like to introduce a professional colleague… Nay, friend: the Qt framework.
While working towards my BS in Comp Sci, I was frustrated at the apparent gap between my existing knowledge and what I’d need to produce the sorts of professional looking, graphical applications used day-to-day on a modern computer (i.e. my Pentium 4 w/ ATI Radeon 9800 pro. It played Quake 3 quite nicely). In retrospect, it was silly of me to worry; we were learning the core, important bits (data structures, algorithms, hardware architecture, etc), and unless you planned to build your own set of tools from scratch, much of what you needed was already out there. Not a matter of discerning arcane knowledge, so much as just sitting yourself down with a book for a week.
Developing these sorts of application, you’ll frequently end up using a framework provided by the platform’s creators (e.g. Cocoa for Macs, .Net for Windows). These frameworks provide any number of features, but for the sake of an abbreviated explanation: they let you create windows, text inputs, buttons, scrollbars, print dialogs, and all the other bits you might need to make an application. That these frameworks are specific to each operating system can be problematic. Should you want to address an audience on multiple platforms, you have a couple options. You can develop your application for the web, architect your code to make it easily portable (replacing only a small subset to handle each platform), or use a framework that works across multiple platforms (e.g. Java, wxWidgets, Qt).
Qt is an open source C++ framework. You write your application once, then compile it on as many platforms as you please (or are currently supported). The platform specific bits become implementation details, hidden behind a single API. It’s surprisingly easy to create your first “hello world” Qt application. As of Qt5, the lovely and capable Qt Creator IDE is included in the installer. Head over to Qt Project to install the necessary libraries / development environment, and follow the Qt Widget tutorial to get a taste. Go ahead, I’ll wait here.
Congratulations, you’ve just written an application that can be compiled and run (without modification) on OSX, Windows, a bajillion different Linux distributions and probably a few other operating systems I don’t know about. With some minor modifications, I believe it can (more or less) be made to run on a number of Nokia phones, the new Blackberry 10 platform, and even Android/iOS (later this year…). The source is open and available for modification so nothing’s stopping a dedicated hacker from porting it to some other, exotic platform (I met a guy at Qt Developer Days one year, who claimed to have ported Qt4 to OS/2!)
In short, the idea is that you write an application once, and get a blazing fast c++ application on all major desktop operating systems. Though there do exist platform dependent details you’ll need to address yourself, such as packaging and deployment. Which brings us full circle to one such small detail, which vexed me for a time.
Oh, and it’s pronounced “cute” (vowels apparently unnecessary for pronunciation, by decree of Trolltech/Digia).