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

Katarina Behrens Katarina.Behrens at cib.de
Thu May 24 13:12:24 UTC 2018


 vcl/CustomTarget_qt5_moc.mk |    1 +
 vcl/inc/qt5/Qt5Menu.hxx     |    6 +++++-
 vcl/qt5/Qt5Menu.cxx         |    8 +++++++-
 3 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit ff4d75891fb947989d16df58a6b2805f20102fc6
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu May 24 15:04:02 2018 +0200

    Basic structure of a slot to dispatch commands from menu
    
    Change-Id: If3a134f67f59d3238c27eb0fef99bf49a8970433

diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk
index aabe77d9a9c5..3962a730d388 100644
--- a/vcl/CustomTarget_qt5_moc.mk
+++ b/vcl/CustomTarget_qt5_moc.mk
@@ -12,6 +12,7 @@ $(eval $(call gb_CustomTarget_CustomTarget,vcl/qt5))
 $(call gb_CustomTarget_get_target,vcl/qt5) : \
 	$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5FilePicker.moc \
 	$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Instance.moc \
+	$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Menu.moc \
 	$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Timer.moc \
 	$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Widget.moc \
 
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
index 38dcc3688b1f..408d97e76520 100644
--- a/vcl/inc/qt5/Qt5Menu.hxx
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -17,8 +17,9 @@ class QMenuBar;
 class Qt5MenuItem;
 class Qt5Frame;
 
-class Qt5Menu : public SalMenu
+class Qt5Menu : public QObject, public SalMenu
 {
+    Q_OBJECT
 private:
     std::vector< Qt5MenuItem* >  maItems;
     VclPtr<Menu>                 mpVCLMenu;
@@ -53,6 +54,9 @@ public:
     Menu*                       GetMenu() { return mpVCLMenu; }
     unsigned                    GetItemCount() { return maItems.size(); }
     Qt5MenuItem*                GetItemAtPos( unsigned nPos ) { return maItems[ nPos ]; }
+
+private slots:
+    void DispatchCommand();
 };
 
 class Qt5MenuItem : public SalMenuItem
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index fd864e8b2422..f7ebc5617d8c 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -9,6 +9,7 @@
 
 #include "Qt5Frame.hxx"
 #include "Qt5Menu.hxx"
+#include <Qt5Menu.moc>
 
 #include <QtWidgets/QtWidgets>
 
@@ -62,7 +63,6 @@ void Qt5Menu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned
 
     pQSubMenu->mpParentSalMenu = this;
     pItem->mpSubMenu = pQSubMenu;
-
 }
 
 void Qt5Menu::SetFrame( const SalFrame* pFrame )
@@ -114,6 +114,7 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
                     // leaf menu
                     QAction *pAction = pQMenu->addAction( toQString(aText) );
                     pAction->setShortcut( toQString( nAccelKey.GetName(GetFrame()->GetWindow()) ) );
+                    connect( pAction, &QAction::triggered, this, &Qt5Menu::DispatchCommand );
                 }
             }
         }
@@ -164,6 +165,11 @@ const Qt5Frame* Qt5Menu::GetFrame() const
     return pMenu ? pMenu->mpFrame : nullptr;
 }
 
+void Qt5Menu::DispatchCommand()
+{
+    SAL_WARN("vcl.qt5", "menu triggered");
+}
+
 void Qt5Menu::NativeItemText( OUString& rItemText )
 {
     rItemText = rItemText.replace( '~', '&' );


More information about the Libreoffice-commits mailing list