Commit faec535829a0e454a6784b0c5c37cb63e7da8f73
- Diff rendering mode:
- inline
- side by side
src/gui/widgets/qmenu.cpp
(5 / 0)
|   | |||
| 1302 | 1302 | do not support the signals: aboutToHide (), aboutToShow () and hovered (). | |
| 1303 | 1303 | It is not possible to display an icon in a native menu on Windows Mobile. | |
| 1304 | 1304 | ||
| 1305 | \section1 QMenu on Mac OS X with Qt build against Cocoa | ||
| 1306 | |||
| 1307 | QMenu can be inserted only once in a menu/menubar. Subsequent insertions will | ||
| 1308 | have no effect or will result in a disabled menu item. | ||
| 1309 | |||
| 1305 | 1310 | See the \l{mainwindows/menus}{Menus} example for an example of how | |
| 1306 | 1311 | to use QMenuBar and QMenu in your application. | |
| 1307 | 1312 |
src/gui/widgets/qmenu_mac.mm
(13 / 2)
|   | |||
| 1412 | 1412 | GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(caused), 0, &caused); | |
| 1413 | 1413 | SetMenuItemProperty(data.submenuHandle, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused); | |
| 1414 | 1414 | #else | |
| 1415 | [item setSubmenu:static_cast<NSMenu *>(action->action->menu()->macMenu())]; | ||
| 1415 | NSMenu *subMenu = static_cast<NSMenu *>(action->action->menu()->macMenu()); | ||
| 1416 | if ([subMenu supermenu] != nil) { | ||
| 1417 | // The menu is already a sub-menu of another one. Cocoa will throw an exception, | ||
| 1418 | // in such cases. For the time being, a new QMenu with same set of actions is the | ||
| 1419 | // only workaround. | ||
| 1420 | action->action->setEnabled(false); | ||
| 1421 | } else { | ||
| 1422 | [item setSubmenu:subMenu]; | ||
| 1423 | } | ||
| 1416 | 1424 | #endif | |
| 1417 | 1425 | } else { //respect some other items | |
| 1418 | 1426 | #ifndef QT_MAC_USE_COCOA | |
| … | … | ||
| 1686 | 1686 | GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(caused), 0, &caused); | |
| 1687 | 1687 | SetMenuItemProperty(submenu, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused); | |
| 1688 | 1688 | #else | |
| 1689 | [item setSubmenu:submenu]; | ||
| 1689 | if ([submenu supermenu] != nil) | ||
| 1690 | return; | ||
| 1691 | else | ||
| 1692 | [item setSubmenu:submenu]; | ||
| 1690 | 1693 | #endif | |
| 1691 | 1694 | } | |
| 1692 | 1695 | #ifndef QT_MAC_USE_COCOA |

