View Full Version : Qt's Cross-Platform Functionality

18th January 2009, 15:27
I don't really understand how QT has achieved cross platform functionality. My guess is that they've had to re-write the underlying code for each new platform. Is that correct? Or am I missing a big piece of the picture?:D

18th January 2009, 15:54
There is a certain set of APIs exposed by any platform to enable developers to write applications for that platform, for example window handling, network/file access, event handling etc. Qt acts as a layer on top of these APIs, providing it's own API to programmers. Ideally, programmers using Qt should never get in touch with the platform's actual API, so all it takes for a Qt application to be run on a different platform would be a recompile on that platform.

So, you are right ;) They have to rewrite the underlying code for every new platform.

18th January 2009, 17:27
Cool, thanks. :D

18th January 2009, 18:31
I believe there are only a dozen files that are platform specific, out of hundreds. In terms of the GUI, there is low level code to draw windows, process events, etc. Everything else is built on top of that. For example, to draw a button on the screen, it will use Windows GDI, or OSX Quartz, or X11 Xlib. I don't know about Quartz, but GDI and Xlib have very similar drawing concepts (pens, brushes, contexts, etc).