[Qt-interest] Is Qt the best choice for cross-platform desktop GUI applications? Mac OS X (Cocoa, Aqua)? KDE, GNOME, Windows 7

Andrew Hodgkinson ahodgkinson at endurancetech.co.uk
Wed Apr 14 01:21:51 CEST 2010


On 13/04/2010 22:50, nobodyhere wrote:

> Have you found any good resources that show specific examples of where
> Qt's Mac OS X support (for Qt 4.6 or later) needs to be improved (to
> make it look and feel more native)?

I've not spent the time worrying! I just use Cocoa / Interface Builder. 
Mind you, the screenshots in another message of yours are interesting 
because they show TextWrangler using a strange toolbar style versus the 
Qt SDI example with a 'right looking' toolbar style. So six of one, half 
dozen of the other on that front... AVI Demux is a QT4 application with 
its own distinct toolbar style which is very "Windowsy" (complete with 
drag handles to move bits of it around) and doesn't work at all like OS 
X. I guess it's just as possible to do the *wrong* thing with just about 
any toolkit :-)

There's a drawer button on the right of that TextWrangler toolbar, which 
brings me to this:

> Also, I use Mac OS X daily (and Windows, and Linux), but I have to
> admit that I'm not sure what you mean by Mac OS X "drawers" and
> "HUD"?

 From developer.apple.com's HIG, URLs shortened because they're fairly 
insane otherwise...:

   http://tinyurl.com/y2nelg2
   http://tinyurl.com/y5p4adl

The phrase "HUD" is a commonly used developer colloquialism to describe 
the translucent inverted colour scheme of transparent panels, which have 
become considerably more widespread since Snow Leopard (the visual style 
is even used for the dock menus, for example).

You can do drawers in Qt (the Qt::Drawer flag) but I've no idea how that 
integrates in practice with slide in/out animation, user dragging and 
so-on (which is all sort of 'automagic' in Interface Builder via the 
underlying Cocoa class), or what happens when you use that in a non-Mac 
build of the application. As for the HUD styles - no idea. More here:

   http://doc.qt.nokia.com/4.6/mac-differences.html

> Do you know of any problems I'd face with Qt (rather than Interface
> Builder) for a simple cross-platform object-based image editor (it
> opens a screen shot, then user draws objects on it, such as labels,
> rectangle masks, and resize / copy-paste / delete these rectangle
> objects) (I was thinking of using QGraphicsView)?

I imagine you could do that really successfully with Qt. You wouldn't 
necessarily be making the most of more specialised Mac GUI features; at 
least, not without a fair bit of extra effort IMHO and an end-result 
which if it looked right on OS X, would probably look kind of weird on 
Windows or Linux where HUD-style panels and drawers are simply not used. 
I guess there must be some specialised GUI bits in newer releases of 
Windows too, though up to around XP it all seemed very generic. I moved 
to the OS X platform when Vista happened and haven't spent enough time 
with that or 7 to discover any new bits of GUI innovation. The Ribbon, 
which isn't strictly an OS-related thing, is maybe the most obvious; 
could have fun trying to make a ribbon-based Qt application with the 
strange combo toolbar and menu concept, versus a more traditional OS X or 
Linux menu-plus-toolbar arrangement. Then there's the whole KDE vs Gnome 
thing for Linux - dunno if Qt can be a 'good citizen' of both.

That's not to say it can't be done. Compile-time switches for all such 
things are of course possible. It's up to you to decide how "native" you 
want your application to look; how much you want to take advantage of 
specialised features like the HUD or lower level stuff like ColorSync 
(can't see anything in the Qt 4.6 API which seems to do the same job), 
along with equivalents (where available) in other operating systems. 
Indeed it could be a very interesting project to see how well you can get 
one code base to make the best use of a variety of platforms with minimal 
duplication or specialisation, if you have the time and inclination for that.

Consider this: A modern image annotation application on Windows 7 would 
probably want to use the latest .NET visual styles and a ribbon. On OS X 
it would have a standard style toolbar and almost certainly use HUD style 
windows for at least some of the image manipulation options - it has to 
be at least as good as Preview.app in Snow Leopard or there's little 
point doing it, aside from an exercise in programming. So how would you 
achieve that in one code base cleanly? Would it make more sense to 
decouple the graphics view side from the various windows hung around it 
and use two projects, one in VS.NET and one in IB, talking to your 
internal API and a common Qt-based core?

It's not that Qt is bad at Mac stuff - it's just that Elfen said 
originally that "very correct native visual style" was required, so my 
comments are made with that in mind. I also think that a genuinely 
"native feeling" application goes somewhat deeper than just a certain 
visual style; it's about spacing and layout (rules vary between operating 
systems so one window layout can't fit all if you're being really 
strict), along with other more muddy concepts like flow, or typical 
wording in menu entries - even down to capitalisation, use of ellipses, 
all kinds of silly things. Just look at the size of the Apple HIG 
document to get some idea of the scope of the problem Qt faces.

-- 
Andrew Hodgkinson, Endurance Technology
Land line: 01223 369 408, mobile: 07855 866 780
Registered Office: 5 Marine Drive West, Bognor Regis, W. Sussex, PO21 2QA



More information about the Qt-interest-old mailing list