diff --git a/src/controls/Menu.qml b/src/controls/Menu.qml index b4ba2e9647d0fcb2d76aa76c3360eed165416aaf..362fe03c71163367020fdf91cb59369bb856779b 100644 --- a/src/controls/Menu.qml +++ b/src/controls/Menu.qml @@ -47,7 +47,6 @@ import "Styles/Settings.js" as Settings \qmltype Menu \inqmlmodule QtQuick.Controls 1.0 \ingroup applicationwindow - \inherits MenuItem \brief Menu provides a menu component for use in menu bars, context menus, and other popup menus. \code @@ -91,6 +90,7 @@ import "Styles/Settings.js" as Settings \sa MenuBar, MenuItem, MenuSeparator */ + MenuPrivate { id: root diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml index 3adae150b5abeedb21e496800c2c20485c41935f..36c111fd799eb9d9b3503d5bbe8fe6b3aa5d77e7 100644 --- a/src/controls/MenuBar.qml +++ b/src/controls/MenuBar.qml @@ -71,15 +71,6 @@ import "Styles/Settings.js" as Settings \sa ApplicationWindow::menuBar */ -/*! - \qmlproperty readonly list MenuBar::menus - \default - - The list of menus in the menu bar. - - \sa Menu -*/ - MenuBarPrivate { id: root diff --git a/src/controls/qtmenu.cpp b/src/controls/qtmenu.cpp index c7281774fd3912eccdff3267674127e4dfab755e..00bf111297fece100116f5a4cbdc9a5e4ff883ab 100644 --- a/src/controls/qtmenu.cpp +++ b/src/controls/qtmenu.cpp @@ -83,8 +83,11 @@ QT_BEGIN_NAMESPACE /*! \qmlproperty string Menu::text - Text for the menu, whether in a \l MenuBar or as a submenu. - Accelerators are supported with the usual \& convention. + Text for the menu as a submenu or in a menubar. + + Mnemonics are supported by prefixing the shortcut letter with \&. + For instance, \c "\&File" will bind the \c Alt-F shortcut to the + \c "File" menu. Note that not all platforms support mnemonics. */ /*! @@ -113,13 +116,13 @@ QT_BEGIN_NAMESPACE /*! \qmlproperty int Menu::selectedIndex - The index for the last selected item in the menu. + The index of the last selected item in the menu. */ /*! \qmlmethod void Menu::popup() - Pops up this menu under the mouse cursor. + Opens this menu under the mouse cursor. It can block on some platforms, so test it accordingly. */ diff --git a/src/controls/qtmenubar.cpp b/src/controls/qtmenubar.cpp index 4f70fb551e627267f33ff16706124168ee947a45..9f7e52e58287c5f67ce8018b9fa16236df82b6e3 100644 --- a/src/controls/qtmenubar.cpp +++ b/src/controls/qtmenubar.cpp @@ -61,6 +61,15 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls 1.0 */ +/*! + \qmlproperty readonly list MenuBar::menus + \default + + The list of menus in the menubar. + + \sa Menu +*/ + QtMenuBar::QtMenuBar(QObject *parent) : QObject(parent), m_contentItem(0), m_parentWindow(0) { diff --git a/src/controls/qtmenuitem.cpp b/src/controls/qtmenuitem.cpp index bf2248d1684849ca540815e459686f635d91e29c..e7878f25c0fed66e49990b1aae85756c2aed812d 100644 --- a/src/controls/qtmenuitem.cpp +++ b/src/controls/qtmenuitem.cpp @@ -232,7 +232,11 @@ void QtMenuText::setIconName(const QString &iconName) /*! \qmlproperty string MenuItem::text - Text for the menu item. Accelerators are supported with the usual \& convention. + Text for the menu item. + + Mnemonics are supported by prefixing the shortcut letter with \&. + For instance, \c "\&Open" will bind the \c Alt-O shortcut to the + \c "Open" menu item. Note that not all platforms support mnemonics. */ /*! @@ -316,7 +320,7 @@ void QtMenuText::setIconName(const QString &iconName) /*! \qmlproperty Action MenuItem::action - The action bound to this menu item. Setting this property to an valid + The action bound to this menu item. Setting this property to a valid \l Action will override all the menu item's properties except \l text. In addition, the menu item \c triggered() and \c toggled() signals will not be emitted. diff --git a/tests/manual/WindowContextMenu.qml b/tests/manual/WindowContextMenu.qml index 7590c9ccf3dc810b937cbf71aa5194e24772e5bd..573c9c4f26757f1b2499699245c7e3648e06d39d 100644 --- a/tests/manual/WindowContextMenu.qml +++ b/tests/manual/WindowContextMenu.qml @@ -51,7 +51,7 @@ Window { Text { id : selctedLabel anchors.centerIn: parent - text : editMenu.itemTextAt(editMenu.selectedIndex) + text : editMenu.selectedIndex >= 0 ? editMenu.items[editMenu.selectedIndex].text : "No selection" } ContextMenu { @@ -76,6 +76,6 @@ Window { MouseArea { anchors.fill: parent acceptedButtons : Qt.RightButton - onClicked: editMenu.showPopup(mouseX, mouseY, 0) + onClicked: editMenu.popup() } }