PDA

View Full Version : Qt/MacOSX preferences menu item



mcenatie
13th March 2006, 09:49
Hello,

I'm developping an application with Qt (I'm working on MacOSX)!! When I run the application, a menu (with the name of the application) is created. This menu contains the preferences item and I wan't to configure it.
So I don't know how to create the preferences dialog box and how link it with Qt !! Does Qt offer functions to configure the preferences menu item?

fullmetalcoder
13th March 2006, 09:58
Hello,

I'm developping an application with Qt (I'm working on MacOSX)!! When I run the application, a menu (with the name of the application) is created. This menu contains the preferences item and I wan't to configure it.
So I don't know how to create the preferences dialog box and how link it with Qt !! Does Qt offer functions to configure the preferences menu item?

Well, not really clear... AFAIUnderstand you want to provide a dialog that allow user to customize your app. Qt does not provide such kind of dialog so you have to create your own and deal with QSettings to save the configuration in a permanent manner.

mcenatie
13th March 2006, 10:19
In fact, when I'm designing my main window, I have only three menus. But when I run the application, there is one more menu ! MacOS X automatically adds this menu and I wan't to know if Qt provides function to modify this menu!!

Matt Smith
13th March 2006, 21:58
In fact, when I'm designing my main window, I have only three menus. But when I run the application, there is one more menu ! MacOS X automatically adds this menu and I wan't to know if Qt provides function to modify this menu!!

If you include a preferences action in your menu bar (with a name like Options or Preferences), it will end up in the Mac OS X application menu (which will have the same title as your application, in bold). Otherwise, it functions exactly as it would when it appears in its normal place in a Windows or X11 app. Everything else - the design of the preferences dialog and processing it - is your job; Qt has a QSettings class to write preferences using either Carbon preferences (on OS X), the registry (on Windows) and an XML file (on X11).

Chicken Blood Machine
14th March 2006, 04:24
Qt has a QSettings class to write preferences using either Carbon preferences (on OS X), the registry (on Windows) and an XML file (on X11).

Actually it writes an ini file on X11. I personally would have preferred an XML file because of its hierarchical structure and a more logical mapping with the Windows registry, GNOME conf, etc.