[Libreoffice-commits] core.git: vcl/qt5

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 26 10:39:21 UTC 2018


 vcl/qt5/Qt5Menu.cxx |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 2d6dfead4b0546c28dcc864dc27488f83d190e3f
Author:     Aleksei Nikiforov <darktemplar at basealt.ru>
AuthorDate: Fri Nov 23 15:24:00 2018 +0300
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon Nov 26 11:38:56 2018 +0100

    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 at cib.de>

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,


More information about the Libreoffice-commits mailing list