From f37397ba3125e1ab5dc940270d90844a6010224f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 6 Jun 2017 20:56:54 +0200 Subject: QQuickMenu::popup(): set the current index If a specific menu item is passed to popup(), set the current index appropriately to highlight the item. Change-Id: Id7b687d1248127fe0c2cdb88d3ebd5689763fe24 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickmenu.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/quicktemplates2/qquickmenu.cpp') diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp index c7dd0ea5..4d1cfc52 100644 --- a/src/quicktemplates2/qquickmenu.cpp +++ b/src/quicktemplates2/qquickmenu.cpp @@ -702,6 +702,9 @@ void QQuickMenu::popup(QQmlV4Function *args) if (!pos.isNull) setPosition(pos); + if (menuItem) + d->setCurrentIndex(d->contentModel->indexOf(menuItem, nullptr)); + open(); } -- cgit v1.2.3