PDA

View Full Version : "Application menu" (like Mac) on all plattforms



Kumula
8th February 2006, 18:08
Hi there,

after plan A (implementing an application menu as in MacOS, decorated with a nice pixmap) has failed (because of a Qt bug, see http://www.qtcentre.org/forum/showthread.php?t=501), I'm thinking about a plan B. And maybe, this would be easier than a pixmap in the menubar:

So first I ask you if it's possible to make menubar items bold? So that it'll look similar to this:
------------------------------------------------------------------------
Program File Edit View Extras Settings ...
------------------------------------------------------------------------

And secondly, maybe there's a Qt way to detect the systems platform? Something like this pseudo-code:


if (QApplication.platform() == "mac"):
makeMacApplicationMenu(macMenuBar)
makeOtherMenuItems(myMenuBar)
else:
makeMyApplicationMenu(myMenuBar)
makeOtherMenuItems(myMenuBar)

Is there a way with Qt3 (or maybe Qt4) to implement this platform-uniform menu?

Thanks a lot for any advice,
Juergen

axeljaeger
8th February 2006, 21:54
Qt will create such a menu for you when running on mac as mentioned on this page:

http://doc.trolltech.com/4.1/qtmac-as-native.html

From my own experience, this works quite well.

http://doc.trolltech.com/4.1/mac-differences.html#compile-time-flags

should help to find out when the app runs on a mac. There are similar defines for other plattforms, sorry, can't find them atm.