Create a parentless menu bar by copying it from the main window menu bar to be used as the default application menu on Mac OS X.

git-svn-id: http://yate.null.ro/svn/yate/trunk@5003 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
oana 2012-04-09 12:31:36 +00:00
parent b8f0736968
commit c27b5a2ebe
2 changed files with 37 additions and 0 deletions

View File

@ -2870,6 +2870,37 @@ void QtWindow::doInit()
wndWidget()->setMinimumHeight(min - h);
else
wndWidget()->setMinimumHeight(0);
#ifdef Q_WS_MAC
if (m_mainWindow) {
// Create a parentless menu bar to be set as the default application menu by copying it from the main window menu
DDebug(QtDriver::self(),DebugAll,"Setting as default menu bar the menu bar of window '%s' [%p]",
m_id.c_str(),this);
QMenuBar* mainMenu = menuBars[0];
QMenuBar* defaultMenu = new QMenuBar(0);
QList<QAction*> topActions = mainMenu->actions();
for (int i = 0; i < topActions.count(); i++) {
QMenu* menu = topActions[i]->menu();
if (menu) {
QMenu* m = new QMenu(menu->title(),defaultMenu);
String tmp;
QtClient::getProperty(menu,YSTRING("_yate_menuNoCopy"),tmp);
if (tmp.toBoolean())
continue;
defaultMenu->addMenu(m);
QList<QAction*> actions = menu->actions();
for (int j = 0; j < actions.count(); j++) {
QAction* act = actions[j];
tmp.clear();
QtClient::getProperty(act,YSTRING("_yate_menuNoCopy"),tmp);
if (tmp.toBoolean())
continue;
m->addAction(act);
}
}
}
}
#endif
}
// Create window's children dynamic properties from config

View File

@ -121,6 +121,9 @@
<property name="title" >
<string>&amp;Friends</string>
</property>
<property name="_yate_menuNoCopy" stdset="0">
<bool>true</bool>
</property>
<widget class="QMenu" name="menuSubscription" >
<property name="title" >
<string>Subscription</string>
@ -3055,6 +3058,9 @@ QTextEdit {
<property name="text" >
<string>Show notifications</string>
</property>
<property name="_yate_menuNoCopy" stdset="0">
<bool>true</bool>
</property>
</action>
<action name="chatcontact_info" >
<property name="icon" >