[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - vcl/qt5

Katarina Behrens Katarina.Behrens at cib.de
Fri May 11 07:10:01 UTC 2018


 vcl/qt5/Qt5Menu.cxx |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit ef5e0f518a561cc30b72719c561e9f18f8fe2009
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed May 9 14:34:24 2018 +0200

    Basic ops (add, remove) with native menu items
    
    nothing's visible yet
    
    Change-Id: Iee9d31ecdb931e64016f8430b51b619a39528726

diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 2471f779c463..5a3753b6433a 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -10,6 +10,8 @@
 #include "Qt5Frame.hxx"
 #include "Qt5Menu.hxx"
 
+#include <vcl/svapp.hxx>
+
 Qt5Menu::Qt5Menu( bool bMenuBar ) :
     mpVCLMenu( nullptr ),
     mpParentSalMenu( nullptr ),
@@ -20,6 +22,7 @@ Qt5Menu::Qt5Menu( bool bMenuBar ) :
 
 Qt5Menu::~Qt5Menu()
 {
+    maItems.clear();
 }
 
 bool Qt5Menu::VisibleMenuBar()
@@ -29,10 +32,21 @@ bool Qt5Menu::VisibleMenuBar()
 
 void Qt5Menu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
 {
+    SolarMutexGuard aGuard;
+    Qt5MenuItem *pItem = static_cast<Qt5MenuItem*>( pSalMenuItem );
+
+    if ( nPos == MENU_APPEND )
+        maItems.push_back( pItem );
+    else
+        maItems.insert( maItems.begin() + nPos, pItem );
+
+    pItem->mpParentMenu = this;
 }
 
 void Qt5Menu::RemoveItem( unsigned nPos )
 {
+    SolarMutexGuard aGuard;
+    maItems.erase( maItems.begin() + nPos );
 }
 
 void Qt5Menu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos )


More information about the Libreoffice-commits mailing list