Kaydet (Commit) 517af5bb authored tarafından Aleksei Nikiforov's avatar Aleksei Nikiforov Kaydeden (comit) Michael Weghorn

tdf#121417 Allow dynamic menu changes for Qt5 and KDE5 interfaces

Separate HandleMenuActivateEvent function call from HandleMenuCommandEvent function call
since first one might update some of menus. Also add call to HandleMenuDeActivateEvent function.

Delete action with Qt5MenuItem to reflect the change in actual menu.

Also update underlying qt-based menu from Qt5Menu::InsertItem function.

And update Qt5Menu::SetItemImage to work with different types of descendants of SalBitmap.
This code is shared between Qt5 and KDE5 plugins, but KDE5 plugin uses SvpSalBitmap instead of Qt5Bitmap.
New image conversion process is borrowed from GTK plugin code.
This approach is used in order to properly process transparency channel if it's present, and it is present usually.

This change also fixes tdf#120789.

Change-Id: Ifdc64c3e5d80782955b52e2da8fcff4844d2dc25
Reviewed-on: https://gerrit.libreoffice.org/63862
Tested-by: Jenkins
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>

Move menu item insertion into separate function

Change-Id: I721910bbbd558827e9a5de1f8763426b460f08fa
Reviewed-on: https://gerrit.libreoffice.org/63861
Tested-by: Jenkins
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>

Fix menu insertion to specified position

Change-Id: I61f870010003fae98d792f95d7fdac0e59d4305c
Reviewed-on: https://gerrit.libreoffice.org/63885
Tested-by: Jenkins
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>

loplugin:override

Change-Id: Ia45b5f7c126c082d8f3835c3c3529a34a9e20975
Reviewed-on: https://gerrit.libreoffice.org/65149
Tested-by: Jenkins
Reviewed-by: 's avatarAleksei Nikiforov <darktemplar@basealt.ru>
Reviewed-by: 's avatarMichael Weghorn <m.weghorn@posteo.de>
üst c3d7933d
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <salmenu.hxx> #include <salmenu.hxx>
class MenuItemList; class MenuItemList;
class QActionGroup;
class QMenu; class QMenu;
class QMenuBar; class QMenuBar;
class Qt5MenuItem; class Qt5MenuItem;
...@@ -27,10 +28,14 @@ private: ...@@ -27,10 +28,14 @@ private:
Qt5Frame* mpFrame; Qt5Frame* mpFrame;
bool mbMenuBar; bool mbMenuBar;
QMenuBar* mpQMenuBar; QMenuBar* mpQMenuBar;
QMenu* mpQMenu;
QActionGroup* mpQActionGroup;
void DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu = nullptr); void DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu = nullptr);
static void NativeItemText(OUString& rItemText); static void NativeItemText(OUString& rItemText);
QMenu* InsertMenuItem(Qt5MenuItem* pSalMenuItem, unsigned nPos);
public: public:
Qt5Menu(bool bMenuBar); Qt5Menu(bool bMenuBar);
virtual ~Qt5Menu() override; virtual ~Qt5Menu() override;
...@@ -64,12 +69,15 @@ Q_SIGNALS: ...@@ -64,12 +69,15 @@ Q_SIGNALS:
private slots: private slots:
static void slotMenuTriggered(Qt5MenuItem* pQItem); static void slotMenuTriggered(Qt5MenuItem* pQItem);
static void slotMenuAboutToShow(Qt5MenuItem* pQItem);
static void slotMenuAboutToHide(Qt5MenuItem* pQItem);
}; };
class Qt5MenuItem : public SalMenuItem class Qt5MenuItem : public SalMenuItem
{ {
public: public:
Qt5MenuItem(const SalItemParams*); Qt5MenuItem(const SalItemParams*);
virtual ~Qt5MenuItem() override;
Qt5Menu* mpParentMenu; // The menu into which this menu item is inserted Qt5Menu* mpParentMenu; // The menu into which this menu item is inserted
Qt5Menu* mpSubMenu; // Submenu of this item (if defined) Qt5Menu* mpSubMenu; // Submenu of this item (if defined)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment