diff options
author | Aleksei Nikiforov <darktemplar@basealt.ru> | 2018-11-23 15:24:00 +0300 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-11-26 11:38:56 +0100 |
commit | 2d6dfead4b0546c28dcc864dc27488f83d190e3f (patch) | |
tree | 7ea1aa92e353a74136306621bbb53147ccffbfa9 | |
parent | b1baf73dc671069bedec18d170f8199b0766ea60 (diff) |
Fix menu insertion to specified position
Change-Id: I61f870010003fae98d792f95d7fdac0e59d4305c
Reviewed-on: https://gerrit.libreoffice.org/63885
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r-- | vcl/qt5/Qt5Menu.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx index 15e0136b18f3..8acaf1e5e410 100644 --- a/vcl/qt5/Qt5Menu.cxx +++ b/vcl/qt5/Qt5Menu.cxx @@ -74,7 +74,18 @@ QMenu* Qt5Menu::InsertMenuItem(Qt5MenuItem* pSalMenuItem, unsigned nPos) if (pSalMenuItem->mpSubMenu) { // submenu - pQMenu = pQMenu->addMenu(toQString(aText)); + if ((nPos != MENU_APPEND) + && (static_cast<size_t>(nPos) < static_cast<size_t>(pQMenu->actions().size()))) + { + QMenu* pTempQMenu = new QMenu(toQString(aText), pQMenu); + pQMenu->insertMenu(pQMenu->actions()[nPos], pTempQMenu); + pQMenu = pTempQMenu; + } + else + { + pQMenu = pQMenu->addMenu(toQString(aText)); + } + mpQActionGroup = new QActionGroup(pQMenu); connect(pQMenu, &QMenu::aboutToShow, this, |