tags:

views:

111

answers:

2

Qt is a nice framework which allows people to develop something once and it will works for the 3 main OSes.

But from times to times, there is some differences in the layout: placing some widgets does not have the same behavior as in windows or linux.

Did you observe weird behavior ? on which Widgets ? how did you corrected this ?

Thanks for sharing

A: 

Well, only differences on OSes I've seen for now where spacing and margins, but it was always done by each OS gui guidelines. Also (I'm not sure if you are familiar with Mac OS X) biggest difference is in QMainWindow and menubar, which on Mac OS X is always on top of screen (not on top of window as on Windows or Linux). I've never had to do any "workaround" with Qt layouts

Kamil Klimek
A: 

I would also suggest you to use QPushButton::setFlat(true) if you are going to style buttons. If you don't do that the margins and positions of the button are not calculated properly in mac since it expect to have the special mac effect area around. You have a similar problem in QLineEdit you need to made a method call to avoid the blue highlight in mac.

There is also a bug in Qt 4.6 and you cannot style QComboBox in mac (you can but the results are very weird). The fonts have different pixel sizes for the same family size, so be carefull if you are doing multi platform applications specially when you have fixed size element with text on it.

Apart from that I don't remember any other big differences. You have crashes that only happens in mac or in windows and something fancy drawing effects if you are doing very complex stuff. Normally the crashes are related to internal Qt code, there are some things that are wrong but they work in on OS and you don't realize the problem till it crash in mac or Linux.

If you are using QGraphicsView in mac be carefull if that view is into an scroll area. For some reason Qt has a bug and sometimes it draws the QGraphicsView outside the window when you scroll the are that contains it.

cnebrera