[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - vcl/inc vcl/qt5
Katarina Behrens
Katarina.Behrens at cib.de
Tue May 15 14:31:15 UTC 2018
vcl/inc/qt5/Qt5Frame.hxx | 3 +++
vcl/inc/qt5/Qt5Menu.hxx | 5 +++++
vcl/qt5/Qt5Frame.cxx | 6 +++++-
vcl/qt5/Qt5Menu.cxx | 28 +++++++++++++++++++++++++++-
4 files changed, 40 insertions(+), 2 deletions(-)
New commits:
commit 8521eb0cbeed45a7c366b252968b8f9935afbda3
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue May 15 16:29:15 2018 +0200
Expose menu bar of the main window
and some addional work on activating menus
Change-Id: I0c4d87dc158f3253aa97d151385fce14551c11b9
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 8772ee7bbfcc..1f881d706881 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -28,6 +28,7 @@
class Qt5Graphics;
class Qt5Instance;
+class Qt5Menu;
class QWidget;
class QPaintDevice;
class QImage;
@@ -55,6 +56,8 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public SalFrame
Qt5Frame* m_pParent;
PointerStyle m_ePointerStyle;
+ Qt5Menu* m_pSalMenu;
+
bool m_bDefaultSize;
bool m_bDefaultPos;
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
index cf7a715f5911..1c0f03b3342c 100644
--- a/vcl/inc/qt5/Qt5Menu.hxx
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -12,6 +12,7 @@
#include <salmenu.hxx>
class MenuItemList;
+class QMenuBar;
class Qt5MenuItem;
class Qt5Frame;
@@ -24,6 +25,10 @@ private:
Qt5Frame* mpFrame;
bool mbMenuBar;
+ QMenuBar* mpQMenuBar;
+
+ void ActivateAllSubMenus( Menu* pMenuBar );
+
public:
Qt5Menu( bool bMenuBar );
virtual ~Qt5Menu() override;
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index ec210c15ade0..4a36bee27776 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -24,6 +24,7 @@
#include "Qt5Graphics.hxx"
#include "Qt5Widget.hxx"
#include "Qt5Data.hxx"
+#include <Qt5Menu.hxx>
#include <QtCore/QPoint>
#include <QtCore/QSize>
@@ -233,7 +234,10 @@ void Qt5Frame::SetIcon(sal_uInt16 nIcon)
m_pQWidget->window()->setWindowIcon(aIcon);
}
-void Qt5Frame::SetMenu(SalMenu* /*pMenu*/) {}
+void Qt5Frame::SetMenu(SalMenu* pMenu)
+{
+ m_pSalMenu = static_cast<Qt5Menu*>( pMenu );
+}
void Qt5Frame::DrawMenuBar() {}
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 5a3753b6433a..4869a78b8a05 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -10,6 +10,8 @@
#include "Qt5Frame.hxx"
#include "Qt5Menu.hxx"
+#include <QtWidgets/QtWidgets>
+
#include <vcl/svapp.hxx>
Qt5Menu::Qt5Menu( bool bMenuBar ) :
@@ -55,8 +57,32 @@ void Qt5Menu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned
void Qt5Menu::SetFrame( const SalFrame* pFrame )
{
-
+ SolarMutexGuard aGuard;
+ assert(mbMenuBar);
mpFrame = const_cast<Qt5Frame*>( static_cast<const Qt5Frame*>( pFrame ) );
+
+ mpFrame->SetMenu( this );
+
+ QWidget* pWidget = mpFrame->GetQWidget();
+ QMainWindow* pMainWindow = dynamic_cast<QMainWindow*>(pWidget);
+ if( pMainWindow )
+ mpQMenuBar = pMainWindow->menuBar();
+
+ ActivateAllSubMenus( mpVCLMenu );
+}
+
+void Qt5Menu::ActivateAllSubMenus( Menu* pMenuBar )
+{
+ for (Qt5MenuItem* pSalItem : maItems)
+ {
+ if ( pSalItem->mpSubMenu != nullptr )
+ {
+ pMenuBar->HandleMenuActivateEvent(pSalItem->mpSubMenu->GetMenu());
+ pSalItem->mpSubMenu->ActivateAllSubMenus(pMenuBar);
+ pSalItem->mpSubMenu->Update();
+ pMenuBar->HandleMenuDeActivateEvent(pSalItem->mpSubMenu->GetMenu());
+ }
+ }
}
void Qt5Menu::ShowItem( unsigned nPos, bool bCheck )
More information about the Libreoffice-commits
mailing list