From 784f04c9fde300e62398d116f3072f66ca3b64bf Mon Sep 17 00:00:00 2001
From: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Date: Fri, 1 Mar 2013 11:17:02 +0100
Subject: [PATCH] Menus: Doc, manual test fixes

Change-Id: I98c4c6aa39f9a947f0610ac976ed74447252d06b
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
---
 src/controls/Menu.qml              |  2 +-
 src/controls/MenuBar.qml           |  9 ---------
 src/controls/qtmenu.cpp            | 11 +++++++----
 src/controls/qtmenubar.cpp         |  9 +++++++++
 src/controls/qtmenuitem.cpp        |  8 ++++++--
 tests/manual/WindowContextMenu.qml |  4 ++--
 6 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/src/controls/Menu.qml b/src/controls/Menu.qml
index b4ba2e964..362fe03c7 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 3adae150b..36c111fd7 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 c7281774f..00bf11129 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 4f70fb551..9f7e52e58 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 bf2248d16..e7878f25c 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 7590c9ccf..573c9c4f2 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()
     }
 }
-- 
GitLab