diff options
author | Aleksei Nikiforov <darktemplar@basealt.ru> | 2018-11-23 12:08:08 +0300 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-11-29 18:37:27 +0100 |
commit | cb37c789c93825232924e797ffcac7fd5edfca6a (patch) | |
tree | 7556175f24d1d6443e25c7eaba4707fb4cf1dff3 /vcl/inc | |
parent | bc0146c2ae43256552c276d2dd86291c98556c42 (diff) |
tdf#120814 KDE5: Assign images to menu items on first build of menu
Treat submenu items similarly to action items.
Qt5MenuItem controls lifetime of menus and actions instead of QMenu or QMenuBar.
Qt5MenuItem may need to remove menus, and thus it may need to delete it.
But if QMenu or QMenuBar owns menu, then on application exit a crash may happen
due to order of destruction of objects.
Change-Id: I66138c5692bd4955e78a805cc774ff9fc8fefb99
Reviewed-on: https://gerrit.libreoffice.org/63886
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/qt5/Qt5Menu.hxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx index 43641f023542..9f7469fa3f78 100644 --- a/vcl/inc/qt5/Qt5Menu.hxx +++ b/vcl/inc/qt5/Qt5Menu.hxx @@ -11,6 +11,8 @@ #include <salmenu.hxx> +#include <memory> + class MenuItemList; class QActionGroup; class QMenu; @@ -77,15 +79,18 @@ class Qt5MenuItem : public SalMenuItem { public: Qt5MenuItem(const SalItemParams*); - virtual ~Qt5MenuItem() override; + + QAction* getAction() const; Qt5Menu* mpParentMenu; // The menu into which this menu item is inserted Qt5Menu* mpSubMenu; // Submenu of this item (if defined) - QAction* mpAction; // action corresponding to this item + std::unique_ptr<QAction> mpAction; // action corresponding to this item + std::unique_ptr<QMenu> mpMenu; // menu corresponding to this item sal_uInt16 mnId; // Item ID MenuItemType mnType; // Item type bool mbVisible; // Item visibility. bool mbEnabled; // Item active. + Image maImage; // Item image }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |