views:

64

answers:

2

I've got a cross platform Qt app, and no matter how I tweak the UI, it always looks good on some platforms and bad on others, due to the differences between UI styles.

For example, margins seem to be universally set, even while the underlying elements shift in size dramatically from one platform to another.

What's the recommended way to handle this?

+2  A: 

Probably the safest way is to have the most basic UI to start with. Personally I use the qt's css type of styling. Also make sure when you subclass your widgets, you properly override event methods (i.e. resizeEvent(...), hand off parameters to a super class when appropriate. etc) Following basic recommendations from the Qt Docs should do it. Another note on layouts, make sure you are using:

enum QSizePolicy::Policy

appropriately and your layouts flow well when resized etc, instead of using fixed positions...

Karol Wilk
+2  A: 

Please take a look at QWindowsStyle, QWindowsXPStyle, QPlastiqueStyle.

And use

void QApplication::setStyle ( QStyle * style )   [static]

By doing this you should have one look on all OS-es.

Narek
But that's not really an ideal solution for a real cross platform app. Nobody wants to be using an app on, say, OS X that looks like a Windows app.
Nantucket
Agreed! Sure. Did you try to set MacOS Style on MacOS, and Windows Style on Windows? May be you will solve the problems with layouts...
Narek