diff options
author | Filippo Cucchetto <[email protected]> | 2015-08-17 17:10:35 +0200 |
---|---|---|
committer | Liang Qi <[email protected]> | 2016-01-29 11:10:32 +0000 |
commit | 4998538c94ed8cb029b8849a60b3f7528eae8311 (patch) | |
tree | bba17e65f3142e4645ab0f79c26ab108c26130bb | |
parent | a33fe70970d891e096fff6a84d7e0c02f8ee978a (diff) |
Fixed key event propagation with submenus
When a menu receive a Key_Right event and its subMenu popupwindow
is already visible, the event should be discarded. In this way
the event can forwarded up to the menubar for moving to the next root menu.
Change-Id: Ifeb402f66fdac9fcf3a541456b929d11d36ad00d
Reviewed-by: J-P Nurmi <[email protected]>
-rw-r--r-- | src/controls/MenuBar.qml | 2 | ||||
-rw-r--r-- | src/controls/Private/MenuContentItem.qml | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml index 444185ccb..8d49a1ed0 100644 --- a/src/controls/MenuBar.qml +++ b/src/controls/MenuBar.qml @@ -246,6 +246,8 @@ MenuBarPrivate { } } + Keys.forwardTo: d.openedMenuIndex !== -1 ? [root.menus[d.openedMenuIndex].__contentItem] : [] + Row { id: row x: d.style ? d.style.padding.left : 0 diff --git a/src/controls/Private/MenuContentItem.qml b/src/controls/Private/MenuContentItem.qml index a0b346c4c..c208e0934 100644 --- a/src/controls/Private/MenuContentItem.qml +++ b/src/controls/Private/MenuContentItem.qml @@ -138,9 +138,13 @@ Loader { Keys.onRightPressed: { var item = content.menuItemAt(__menu.__currentIndex) - if ((event.accepted = (item && item.styleData.type === MenuItemType.Menu))) { + if (item && item.styleData.type === MenuItemType.Menu + && !item.__menuItem.__popupVisible) { item.__showSubMenu(true) item.__menuItem.__currentIndex = 0 + event.accepted = true + } else { + event.accepted = false } } |