Qt/Win and API Layering vs. GUI emulation

Michael O'Keeffe michaelok at gmail.com
Mon Sep 5 06:38:54 CEST 2005


I see the following on the Qt/Win web site:

"The Qt3/Windows Free Edition is a native win32 port of the gplŽed
qt(r)/x11 sources. It use native win32 api and does not require cygwin."

And this from the TrollTech site:
" Qt/Windows uses the native Windows API and does not require any
special additional libraries."

According to Matthias Dalheimer's Programming with Qt book, Qt is a
GUI-emulation toolkit.  "GUI-emulating toolkits don't use any
native-toolkit calls at all.  Instead they use the drawing or graphics
primitives of the respective platforms.  Each widget is drawn inside
the emulating toolkit."  I believe I read the same in the TrollTech
book, C++ GUI Programming with Qt.

On the other hand, API layering is where the calls are mapped to the
native API: "The wxWindows methods map to Win32 API calls on Windows
and to either Motif or Xt API calls on Unix (as far as I know, no
version exists for the MacOS X)."

Is this still correct?  From the web sites, it seems to me Qt/Win uses
API Layering.

I'm familiar with the Java AWT, Swing and SWT, is this is how SWT works.

SWT is the Software Widget Toolkit used by the Eclipse project
(http://www.eclipse.org)?  See the links below for additional detail,
but essentially SWT uses JNI (Java Native Interface) to make Win32
calls from Java, so that if native widgets are available they can be
used (else they are emulated).  The API is the same, whether Win32 or
Motif for example, however the Java/JNI code would be different for
each platform, so the app's code is portable, however the widget code
isn't.

This is to be compared with the Swing, where the widgets are emulated
(GUI Emulation I think), so that no matter what platform you are
running on, the app will have a "swing-ish" look and feel.  Further
you can do interesting things with Themes, like Linux perhaps, i.e.
you can have a Mac theme on a Windows OS.  But as I saw explained on a
Java post somewhere, this is like the town facades in the movies of
the old west, underneath is the same implementation.

AWT (Abstract Window Toolkit) which preceded Swing and SWT, uses API
layering, so if the widget was not available, it was not implemented

To conclude, is this information outdated, and Qt/Win and Qt/Win Free
use API layering?  Or do they use GUI emulation?  Or some sort of
hybrid?

-Mike

Simple explanation of how SWT works vs. Swing and AWT
http://www-128.ibm.com/developerworks/java/library/j-nativegui/

Intro to SWT
http://www.eclipse.org/articles/Article-SWT-Design-1/SWT-Design-1.html

Comparison:  Eclipse (SWT app) vs. Net Beans (Swing) on Windows Vista:
http://weblogs.java.net/blog/chet/archive/2005/08/mustang_swing_a.html


More information about the kde-cygwin mailing list