summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-01-30 21:11:09 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-01-30 21:11:13 +0100
commite2d7c49923c946eacb4ea635b78f1a06eeffd5c6 (patch)
tree58cc98de3bad24e9937d36f260ebcf3d44ac4294
parentb834f742994e5dce69c3fdc161099f2ed20deff9 (diff)
parent4998538c94ed8cb029b8849a60b3f7528eae8311 (diff)
downloadqtquickcontrols-e2d7c49923c946eacb4ea635b78f1a06eeffd5c6.tar.gz
Merge remote-tracking branch 'origin/5.5' into 5.6.0
Change-Id: Ideb3ff546c83f52df6fa6a61fa7f91c628c43021
-rw-r--r--src/controls/MenuBar.qml2
-rw-r--r--src/controls/Private/MenuContentItem.qml6
-rw-r--r--src/controls/qquickmenupopupwindow.cpp7
-rw-r--r--src/controls/qquickmenupopupwindow_p.h1
4 files changed, 15 insertions, 1 deletions
diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml
index a16635ff..cb31ed71 100644
--- a/src/controls/MenuBar.qml
+++ b/src/controls/MenuBar.qml
@@ -247,6 +247,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 e3be2e44..5a827b61 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
}
}
diff --git a/src/controls/qquickmenupopupwindow.cpp b/src/controls/qquickmenupopupwindow.cpp
index 8d821d84..670ad6aa 100644
--- a/src/controls/qquickmenupopupwindow.cpp
+++ b/src/controls/qquickmenupopupwindow.cpp
@@ -148,6 +148,13 @@ void QQuickMenuPopupWindow::updatePosition()
setGeometry(newPos.x(), newPos.y(), width(), height());
}
+void QQuickMenuPopupWindow::focusInEvent(QFocusEvent *e)
+{
+ QQuickWindow::focusInEvent(e);
+ if (m_menu && m_menu->menuContentItem())
+ m_menu->menuContentItem()->forceActiveFocus();
+}
+
void QQuickMenuPopupWindow::exposeEvent(QExposeEvent *e)
{
// the popup will reposition at the last moment, so its
diff --git a/src/controls/qquickmenupopupwindow_p.h b/src/controls/qquickmenupopupwindow_p.h
index 5cff75af..abee1f83 100644
--- a/src/controls/qquickmenupopupwindow_p.h
+++ b/src/controls/qquickmenupopupwindow_p.h
@@ -68,6 +68,7 @@ Q_SIGNALS:
void willBeDeletedLater();
protected:
+ void focusInEvent(QFocusEvent *);
void exposeEvent(QExposeEvent *);
bool shouldForwardEventAfterDismiss(QMouseEvent *) const;